auto-create table IF NOT EXISTS on startup
This commit is contained in:
@@ -19,6 +19,16 @@
|
|||||||
<cfif NOT isDefined("request.tableName") OR NOT len(request.tableName)>
|
<cfif NOT isDefined("request.tableName") OR NOT len(request.tableName)>
|
||||||
<cfset request.tableName = "check_point" />
|
<cfset request.tableName = "check_point" />
|
||||||
</cfif>
|
</cfif>
|
||||||
|
<cftry>
|
||||||
|
<cfquery>
|
||||||
|
CREATE TABLE IF NOT EXISTS #request.tableName# (
|
||||||
|
id SERIAL PRIMARY KEY,
|
||||||
|
value INTEGER NOT NULL
|
||||||
|
)
|
||||||
|
</cfquery>
|
||||||
|
<cfcatch type="database"></cfcatch>
|
||||||
|
</cftry>
|
||||||
|
|
||||||
<cfreturn true />
|
<cfreturn true />
|
||||||
</cffunction>
|
</cffunction>
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user