end
end
+ def self.add_primary_key(tablename, columnname)
+ if dialect()=="mysql"
+ execute "ALTER TABLE `#{tablename}` ADD PRIMARY KEY (`#{columnname}`)"
+ else
+ execute "ALTER TABLE #{tablename} ADD CONSTRAINT pk_#{tablename} PRIMARY KEY (#{columnname})"
+ end
+ end
+
# SONAR-4178
def self.create_table(table_name, options = {})
# Oracle constraint (see names of triggers and indices)
t.column 'created_at', :big_integer, :null => false
t.column 'updated_at', :big_integer, :null => false
end
- add_index 'ce_task_input', 'task_uuid', :name => 'ce_task_input_uuid', :unique => true
+ add_primary_key 'ce_task_input', 'task_uuid'
end
end
);
CREATE TABLE "CE_TASK_INPUT" (
- "ID" INTEGER NOT NULL GENERATED BY DEFAULT AS IDENTITY (START WITH 1, INCREMENT BY 1),
- "TASK_UUID" VARCHAR(40) NOT NULL,
+ "TASK_UUID" VARCHAR(40) NOT NULL PRIMARY KEY,
"DATA" BLOB(167772150),
"CREATED_AT" BIGINT NOT NULL,
"UPDATED_AT" BIGINT NOT NULL
CREATE INDEX "CE_ACTIVITY_ISLAST_STATUS" ON "CE_ACTIVITY" ("IS_LAST", "STATUS");
-CREATE UNIQUE INDEX "CE_TASK_INPUT_UUID" ON "CE_TASK_INPUT" ("TASK_UUID");
-
CREATE UNIQUE INDEX "UNIQ_PERM_TPL_CHARAC" ON "PERM_TPL_CHARACTERISTICS" ("TEMPLATE_ID", "PERMISSION_KEY");
CREATE UNIQUE INDEX "SCANNER_CONTEXT_ANALYSIS_UUID" ON "SCANNER_CONTEXT" ("ANALYSIS_UUID");