Please provide a forms.pgsql file for new users like me who don't know how to modify the mysql file.

CommentFileSizeAuthor
#2 forms.pgsql723 bytesklance

Comments

commanderfoxtrot’s picture

Title: PostGreSQL Support » PostGreSQL Support - table creation script
Version: 4.5.x-1.x-dev » 4.6.x-1.x-dev

grcm forms # cat forms.pgsql
CREATE TABLE forms (
fid int NOT NULL,
type varchar(16) NOT NULL,
created int NOT NULL,
PRIMARY KEY (fid)
);

CREATE TABLE form_fields (
ffid int NOT NULL,
fid int NOT NULL,
title varchar(255) default NULL,
explanation TEXT default NULL,
page varchar(255) default NULL,
type varchar(128) default NULL,
weight smallint DEFAULT '0' NOT NULL,
required smallint DEFAULT '0' NOT NULL,
flags text,
validation text,
options text,
multiple smallint DEFAULT '0' NOT NULL,
PRIMARY KEY (ffid)
);
CREATE SEQUENCE form_fields_ffid_seq INCREMENT 1 START 1;

I don't know if this works, but it runs without errors, so try it.

klance’s picture

StatusFileSize
new723 bytes

I didn't read this before modifying the create script, but I think mine is the same as commanderfoxtrot's, except that I created a sequence for the forms table's primary key, because it was defaulting to '0' for every form, causing unique constraint violations on the primary key.

BTW I have tested the Forms API in PostgreSQL with the Survey module and translated surveys successfully with the I18N module, in case anyone's interested.

CREATE SEQUENCE forms_fid_seq INCREMENT 1 START 1;

CREATE TABLE forms (
fid INTEGER NOT NULL default nextval( 'forms_fid_seq' ),
type VARCHAR(16) NOT NULL,
created INTEGER NOT NULL,
PRIMARY KEY (fid)
);

CREATE SEQUENCE form_fields_ffid_seq INCREMENT 1 START 1;

CREATE TABLE form_fields (
ffid INTEGER NOT NULL DEFAULT nextval( 'form_fields_ffid_seq' ),
fid INTEGER NOT NULL,
title VARCHAR(255) DEFAULT NULL,
explanation TEXT DEFAULT NULL,
page VARCHAR(255) DEFAULT NULL,
type VARCHAR(128) DEFAULT NULL,
weight SMALLINT DEFAULT '0' NOT NULL,
required SMALLINT DEFAULT '0' NOT NULL,
flags TEXT,
validation TEXT,
options TEXT,
multiple SMALLINT DEFAULT '0' NOT NULL,
PRIMARY KEY (ffid)
);

darren oh’s picture

Status: Active » Closed (won't fix)

Work has moved on to newer projects.