Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Generated Identity for example datasets #4075

Merged
merged 4 commits into from
Dec 13, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
101 changes: 21 additions & 80 deletions mathesar/examples/resources/library_without_checkouts.sql
Original file line number Diff line number Diff line change
@@ -7,15 +7,9 @@ CREATE TABLE "Authors" (
"Website" mathesar_types.uri
);

CREATE SEQUENCE "Authors_id_seq"
AS integer
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;

ALTER SEQUENCE "Authors_id_seq" OWNED BY "Authors".id;
ALTER TABLE "Authors" ALTER COLUMN id ADD GENERATED BY DEFAULT AS IDENTITY (
SEQUENCE NAME "Authors_id_seq"
);


-- Books
@@ -34,15 +28,9 @@ CREATE TABLE "Books" (
"Publisher" integer
);

CREATE SEQUENCE "Books_id_seq"
AS integer
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;

ALTER SEQUENCE "Books_id_seq" OWNED BY "Books".id;
ALTER TABLE "Books" ALTER COLUMN id ADD GENERATED BY DEFAULT AS IDENTITY (
SEQUENCE NAME "Books_id_seq"
);


-- Checkouts
@@ -56,15 +44,9 @@ CREATE TABLE "Checkouts" (
"Check In Time" timestamp without time zone
);

CREATE SEQUENCE "Checkouts_id_seq"
AS integer
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;

ALTER SEQUENCE "Checkouts_id_seq" OWNED BY "Checkouts".id;
ALTER TABLE "Checkouts" ALTER COLUMN id ADD GENERATED BY DEFAULT AS IDENTITY (
SEQUENCE NAME "Checkouts_id_seq"
);


-- Items
@@ -78,15 +60,9 @@ CREATE TABLE "Items" (
);


CREATE SEQUENCE "Items_id_seq"
AS integer
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;

ALTER SEQUENCE "Items_id_seq" OWNED BY "Items".id;
ALTER TABLE "Items" ALTER COLUMN id ADD GENERATED BY DEFAULT AS IDENTITY (
SEQUENCE NAME "Items_id_seq"
);


-- Media
@@ -96,15 +72,9 @@ CREATE TABLE "Media" (
"Type" text
);

CREATE SEQUENCE "Media_id_seq"
AS integer
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;

ALTER SEQUENCE "Media_id_seq" OWNED BY "Media".id;
ALTER TABLE "Media" ALTER COLUMN id ADD GENERATED BY DEFAULT AS IDENTITY (
SEQUENCE NAME "Media_id_seq"
);


-- Patrons
@@ -116,15 +86,9 @@ CREATE TABLE "Patrons" (
"Email" mathesar_types.email
);

CREATE SEQUENCE "Patrons_id_seq"
AS integer
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;

ALTER SEQUENCE "Patrons_id_seq" OWNED BY "Patrons".id;
ALTER TABLE "Patrons" ALTER COLUMN id ADD GENERATED BY DEFAULT AS IDENTITY (
SEQUENCE NAME "Patrons_id_seq"
);


-- Publishers
@@ -134,32 +98,9 @@ CREATE TABLE "Publishers" (
"Name" text
);

CREATE SEQUENCE "Publishers_id_seq"
AS integer
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;

ALTER SEQUENCE "Publishers_id_seq" OWNED BY "Publishers".id;


-- Set up defaults
ALTER TABLE ONLY "Authors"
ALTER COLUMN id SET DEFAULT nextval('"Authors_id_seq"'::regclass);
ALTER TABLE ONLY "Books"
ALTER COLUMN id SET DEFAULT nextval('"Books_id_seq"'::regclass);
ALTER TABLE ONLY "Checkouts"
ALTER COLUMN id SET DEFAULT nextval('"Checkouts_id_seq"'::regclass);
ALTER TABLE ONLY "Items"
ALTER COLUMN id SET DEFAULT nextval('"Items_id_seq"'::regclass);
ALTER TABLE ONLY "Media"
ALTER COLUMN id SET DEFAULT nextval('"Media_id_seq"'::regclass);
ALTER TABLE ONLY "Patrons"
ALTER COLUMN id SET DEFAULT nextval('"Patrons_id_seq"'::regclass);
ALTER TABLE ONLY "Publishers"
ALTER COLUMN id SET DEFAULT nextval('"Publishers_id_seq"'::regclass);
ALTER TABLE "Publishers" ALTER COLUMN id ADD GENERATED BY DEFAULT AS IDENTITY (
SEQUENCE NAME "Publishers_id_seq"
);

--
-- Data for Name: Authors; Type: TABLE DATA; Schema: Library Management; Owner: -
227 changes: 45 additions & 182 deletions mathesar/examples/resources/movie_collection_tables.sql
Original file line number Diff line number Diff line change
@@ -7,19 +7,9 @@ CREATE TABLE "Departments" (
"Name" text
);

CREATE SEQUENCE "Departments_id_seq"
AS integer
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;

ALTER SEQUENCE "Departments_id_seq" OWNED BY "Departments".id;

ALTER TABLE ONLY "Departments"
ALTER COLUMN id SET DEFAULT nextval('"Departments_id_seq"'::regclass);

ALTER TABLE "Departments" ALTER COLUMN id ADD GENERATED BY DEFAULT AS IDENTITY (
SEQUENCE NAME "Departments_id_seq"
);

-- Genres

@@ -28,19 +18,9 @@ CREATE TABLE "Genres" (
"Name" text
);


CREATE SEQUENCE "Genres_id_seq"
AS integer
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;

ALTER SEQUENCE "Genres_id_seq" OWNED BY "Genres".id;

ALTER TABLE ONLY "Genres"
ALTER COLUMN id SET DEFAULT nextval('"Genres_id_seq"'::regclass);
ALTER TABLE "Genres" ALTER COLUMN id ADD GENERATED BY DEFAULT AS IDENTITY (
SEQUENCE NAME "Genres_id_seq"
);


-- Jobs
@@ -50,18 +30,9 @@ CREATE TABLE "Jobs" (
"Name" text
);

CREATE SEQUENCE "Jobs_id_seq"
AS integer
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;

ALTER SEQUENCE "Jobs_id_seq" OWNED BY "Jobs".id;

ALTER TABLE ONLY "Jobs"
ALTER COLUMN id SET DEFAULT nextval('"Jobs_id_seq"'::regclass);
ALTER TABLE "Jobs" ALTER COLUMN id ADD GENERATED BY DEFAULT AS IDENTITY (
SEQUENCE NAME "Jobs_id_seq"
);


-- Movie Cast Map
@@ -74,18 +45,9 @@ CREATE TABLE "Movie Cast Map" (
"Credit Order" integer
);

CREATE SEQUENCE "Movie Cast Map_id_seq"
AS integer
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;

ALTER SEQUENCE "Movie Cast Map_id_seq" OWNED BY "Movie Cast Map".id;

ALTER TABLE ONLY "Movie Cast Map"
ALTER COLUMN id SET DEFAULT nextval('"Movie Cast Map_id_seq"'::regclass);
ALTER TABLE "Movie Cast Map" ALTER COLUMN id ADD GENERATED BY DEFAULT AS IDENTITY (
SEQUENCE NAME "Movie Cast Map_id_seq"
);


-- Movie Crew Map
@@ -98,18 +60,9 @@ CREATE TABLE "Movie Crew Map" (
"Crew Member" integer NOT NULL
);

CREATE SEQUENCE "Movie Crew Map_id_seq"
AS integer
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;

ALTER SEQUENCE "Movie Crew Map_id_seq" OWNED BY "Movie Crew Map".id;

ALTER TABLE ONLY "Movie Crew Map"
ALTER COLUMN id SET DEFAULT nextval('"Movie Crew Map_id_seq"'::regclass);
ALTER TABLE "Movie Crew Map" ALTER COLUMN id ADD GENERATED BY DEFAULT AS IDENTITY (
SEQUENCE NAME "Movie Crew Map_id_seq"
);


-- Movie Genre Map
@@ -120,18 +73,9 @@ CREATE TABLE "Movie Genre Map" (
"Genre" integer
);

CREATE SEQUENCE "Movie Genre Map_id_seq"
AS integer
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;

ALTER SEQUENCE "Movie Genre Map_id_seq" OWNED BY "Movie Genre Map".id;

ALTER TABLE ONLY "Movie Genre Map"
ALTER COLUMN id SET DEFAULT nextval('"Movie Genre Map_id_seq"'::regclass);
ALTER TABLE "Movie Genre Map" ALTER COLUMN id ADD GENERATED BY DEFAULT AS IDENTITY (
SEQUENCE NAME "Movie Genre Map_id_seq"
);


-- Movie Production Company Map
@@ -142,18 +86,9 @@ CREATE TABLE "Movie Production Company Map" (
"Production Company" integer
);

CREATE SEQUENCE "Movie Production Company Map_id_seq"
AS integer
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;

ALTER SEQUENCE "Movie Production Company Map_id_seq" OWNED BY "Movie Production Company Map".id;

ALTER TABLE ONLY "Movie Production Company Map"
ALTER COLUMN id SET DEFAULT nextval('"Movie Production Company Map_id_seq"'::regclass);
ALTER TABLE "Movie Production Company Map" ALTER COLUMN id ADD GENERATED BY DEFAULT AS IDENTITY (
SEQUENCE NAME "Movie Production Company Map_id_seq"
);


-- Movie Production Country Map
@@ -164,18 +99,9 @@ CREATE TABLE "Movie Production Country Map" (
"Production Country" integer NOT NULL
);

CREATE SEQUENCE "Movie Production Country Map_id_seq"
AS integer
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;

ALTER SEQUENCE "Movie Production Country Map_id_seq" OWNED BY "Movie Production Country Map".id;

ALTER TABLE ONLY "Movie Production Country Map"
ALTER COLUMN id SET DEFAULT nextval('"Movie Production Country Map_id_seq"'::regclass);
ALTER TABLE "Movie Production Country Map" ALTER COLUMN id ADD GENERATED BY DEFAULT AS IDENTITY (
SEQUENCE NAME "Movie Production Country Map_id_seq"
);


-- Movie Spoken Language Map
@@ -186,18 +112,9 @@ CREATE TABLE "Movie Spoken Language Map" (
"Spoken Language" integer NOT NULL
);

CREATE SEQUENCE "Movie Spoken Language Map_id_seq"
AS integer
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;

ALTER SEQUENCE "Movie Spoken Language Map_id_seq" OWNED BY "Movie Spoken Language Map".id;

ALTER TABLE ONLY "Movie Spoken Language Map"
ALTER COLUMN id SET DEFAULT nextval('"Movie Spoken Language Map_id_seq"'::regclass);
ALTER TABLE "Movie Spoken Language Map" ALTER COLUMN id ADD GENERATED BY DEFAULT AS IDENTITY (
SEQUENCE NAME "Movie Spoken Language Map_id_seq"
);


-- Movies
@@ -218,18 +135,9 @@ CREATE TABLE "Movies" (
"Original Language" text
);

CREATE SEQUENCE "Movies_id_seq"
AS integer
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;

ALTER SEQUENCE "Movies_id_seq" OWNED BY "Movies".id;

ALTER TABLE ONLY "Movies"
ALTER COLUMN id SET DEFAULT nextval('"Movies_id_seq"'::regclass);
ALTER TABLE "Movies" ALTER COLUMN id ADD GENERATED BY DEFAULT AS IDENTITY (
SEQUENCE NAME "Movies_id_seq"
);


-- People
@@ -239,18 +147,9 @@ CREATE TABLE "People" (
"Name" text
);

CREATE SEQUENCE "People_id_seq"
AS integer
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;

ALTER SEQUENCE "People_id_seq" OWNED BY "People".id;

ALTER TABLE ONLY "People"
ALTER COLUMN id SET DEFAULT nextval('"People_id_seq"'::regclass);
ALTER TABLE "People" ALTER COLUMN id ADD GENERATED BY DEFAULT AS IDENTITY (
SEQUENCE NAME "People_id_seq"
);


-- Production Companies
@@ -260,18 +159,9 @@ CREATE TABLE "Production Companies" (
"Name" text
);

CREATE SEQUENCE "Production Companies_id_seq"
AS integer
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;

ALTER SEQUENCE "Production Companies_id_seq" OWNED BY "Production Companies".id;

ALTER TABLE ONLY "Production Companies"
ALTER COLUMN id SET DEFAULT nextval('"Production Companies_id_seq"'::regclass);
ALTER TABLE "Production Companies" ALTER COLUMN id ADD GENERATED BY DEFAULT AS IDENTITY (
SEQUENCE NAME "Production Companies_id_seq"
);


-- Production Countries
@@ -282,18 +172,9 @@ CREATE TABLE "Production Countries" (
"ISO 3166-1" character(2) NOT NULL
);

CREATE SEQUENCE "Production Countries_id_seq"
AS integer
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;

ALTER SEQUENCE "Production Countries_id_seq" OWNED BY "Production Countries".id;

ALTER TABLE ONLY "Production Countries"
ALTER COLUMN id SET DEFAULT nextval('"Production Countries_id_seq"'::regclass);
ALTER TABLE "Production Countries" ALTER COLUMN id ADD GENERATED BY DEFAULT AS IDENTITY (
SEQUENCE NAME "Production Countries_id_seq"
);


-- Spoken Languages
@@ -304,18 +185,9 @@ CREATE TABLE "Spoken Languages" (
"ISO 639-1" character(2) NOT NULL
);

CREATE SEQUENCE "Spoken Languages_id_seq"
AS integer
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;

ALTER SEQUENCE "Spoken Languages_id_seq" OWNED BY "Spoken Languages".id;

ALTER TABLE ONLY "Spoken Languages"
ALTER COLUMN id SET DEFAULT nextval('"Spoken Languages_id_seq"'::regclass);
ALTER TABLE "Spoken Languages" ALTER COLUMN id ADD GENERATED BY DEFAULT AS IDENTITY (
SEQUENCE NAME "Spoken Languages_id_seq"
);


-- Sub-Collections
@@ -325,15 +197,6 @@ CREATE TABLE "Sub-Collections" (
"Name" text
);

CREATE SEQUENCE "Sub-Collections_id_seq"
AS integer
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;

ALTER SEQUENCE "Sub-Collections_id_seq" OWNED BY "Sub-Collections".id;

ALTER TABLE ONLY "Sub-Collections"
ALTER COLUMN id SET DEFAULT nextval('"Sub-Collections_id_seq"'::regclass);
ALTER TABLE "Sub-Collections" ALTER COLUMN id ADD GENERATED BY DEFAULT AS IDENTITY (
SEQUENCE NAME "Sub-Collections_id_seq"
);