My code has multiples queries used for creating tables and stored procedures and I used to create those stuff running one by one, but I would like to know if I can run all of those queries pressing run simply.
I guess my code is not important now, but i add it in case of (a chunk of it):
set timezone to 'America/Santo_Domingo';
CREATE TABLE "role" (
"role" varchar(40) NOT NULL,
"description" varchar,
PRIMARY KEY ("role")
);
CREATE TABLE "member" (
"id" SERIAL,
"email" varchar NOT NULL,
"password" varchar(40) NOT NULL,
"name" varchar(40) NOT NULL,
"role" varchar NOT NULL,
"date" date,
PRIMARY KEY ("email"),
CONSTRAINT "FK_member.role"
FOREIGN KEY ("role")
REFERENCES "role"("role")
);
CREATE TABLE "membership" (
"id" SERIAL,
"email_member" varchar NOT NULL UNIQUE,
"type" varchar NOT NULL DEFAULT 'GRATIS',
"started" date,
"finished" date,
"status" varchar,
PRIMARY KEY ("id"),
CONSTRAINT "FK_membership.email_member"
FOREIGN KEY ("email_member")
REFERENCES "member"("email"),
CONSTRAINT "FK_membership.type"
FOREIGN KEY ("type")
REFERENCES "type_membership"("type")
);
CREATE TABLE "type_membership" (
"type" varchar UNIQUE,
"price_month" int,
PRIMA
How can I run all this code once time? (obviously, if it is possible)
That's PostgreSQL code.
Thanks, experts!
CodePudding user response:
If all statements are terminated with a semi-colon, then the "Execute pgScript" button in pgAdmin should run all statements.