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

Initial database schema #53

Draft
wants to merge 73 commits into
base: v5-develop
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from 37 commits
Commits
Show all changes
73 commits
Select commit Hold shift + click to select a range
2d57521
Continue adding init database sql, and add inheritance tables
mitchdowney Aug 12, 2024
6f21f91
Continue adding initial database schema
mitchdowney Aug 14, 2024
b18ccdf
Rename Podcasting 2.0 database init file
mitchdowney Aug 14, 2024
173ef69
Add categories and missing NOT NULL to relationships
mitchdowney Aug 14, 2024
b156bd9
Add account table
mitchdowney Aug 14, 2024
3f4d5c3
Set varchar_long to 2500; add chapter hash column
mitchdowney Aug 14, 2024
ddbc6f2
Add unique id to inherits tables that can only have one row per forei…
mitchdowney Aug 14, 2024
f9f08c0
Add clip table
mitchdowney Aug 14, 2024
f33f1c0
Add sharable_status to account and clip
mitchdowney Aug 14, 2024
3c1001a
Fix item_chapter reference
mitchdowney Aug 14, 2024
bcaa8d8
Add playlist and playlist_item tables
mitchdowney Aug 14, 2024
cb89380
Rename clip table to item_clip
mitchdowney Aug 14, 2024
858c505
Remove extra linebreaks
mitchdowney Aug 14, 2024
ee46019
Change short_id to short_id_v2
mitchdowney Aug 15, 2024
54b4edb
Rename item_clip to clip
mitchdowney Aug 15, 2024
02436e6
Add playlist_item_item_add_by_rss table
mitchdowney Aug 15, 2024
b9eb4a6
Rename playlist_item to playlist_content
mitchdowney Aug 15, 2024
4478fe3
More initial helpers to their own sql file
mitchdowney Aug 15, 2024
e7911f3
Add updated_at handling to a couple columns
mitchdowney Aug 15, 2024
075f34d
Add now_playing_content table
mitchdowney Aug 15, 2024
1c45c62
Add queue_content table
mitchdowney Aug 15, 2024
59f6827
Fix invalid table names
mitchdowney Aug 15, 2024
38c2bf7
Add cascade delete rules to account sub-tables
mitchdowney Aug 17, 2024
8264b6b
Continue initial database
mitchdowney Aug 17, 2024
3d1b899
Add missing id serial to category
mitchdowney Aug 17, 2024
e667ce0
Rename playlist_content to playlist_resource
mitchdowney Aug 17, 2024
6787cee
Replace most INHERITS tables with separate tables
mitchdowney Aug 17, 2024
53e9244
Add account_following tables
mitchdowney Aug 18, 2024
9c5b2d5
Add notes and cleanup 0001 migration
mitchdowney Aug 18, 2024
22f4a8b
Move database sql files into migrations directory
mitchdowney Aug 18, 2024
00fc443
Add combine_all_migrations script
mitchdowney Aug 18, 2024
f8d42a6
Add headers to migration files
mitchdowney Aug 18, 2024
128ac6d
Add notification tables including up_device and fcm_device
mitchdowney Aug 18, 2024
93375b9
Add paypal, apple, and google purchase tables
mitchdowney Aug 18, 2024
5c641ec
Add account_claim_token table
mitchdowney Aug 18, 2024
338c9ca
Update init_database.sql
mitchdowney Aug 18, 2024
a5df4c1
Continue updating initial database migrations
mitchdowney Aug 19, 2024
a855946
Remove bigint timestamp columns
mitchdowney Aug 21, 2024
082c756
Updates to 0001 sql columns
mitchdowney Aug 27, 2024
165198c
Update 0001 channel columns
mitchdowney Aug 27, 2024
f121021
Make channel title optional
mitchdowney Aug 27, 2024
474df58
Update txt table names and columns
mitchdowney Aug 29, 2024
3c615e3
Change value_tag to value
mitchdowney Aug 29, 2024
4761e32
Remove unnecessary channel_value_time_split tables
mitchdowney Aug 29, 2024
231435b
Change medium_value to medium
mitchdowney Aug 30, 2024
3252aec
Change medium_value to medium; add guid_enclosure_url to item
mitchdowney Aug 30, 2024
4e8887f
Update comment
mitchdowney Aug 30, 2024
1ba48d3
Add item_chapters_feed_log
mitchdowney Aug 30, 2024
e105f5c
Remove unused item_chapters_feed log columns
mitchdowney Aug 30, 2024
9b293ed
Add missing column to item_Person and item_season_episode
mitchdowney Aug 30, 2024
23af605
Remove url column from item_soundbite
mitchdowney Aug 30, 2024
571438a
Use numeric instead of integer for player times
mitchdowney Aug 30, 2024
c441896
Fix typos in "recipient" spelling
mitchdowney Aug 31, 2024
8915aa8
Update item_season_episode table
mitchdowney Aug 31, 2024
dae2c66
Make protocol column required in chat tables
mitchdowney Aug 31, 2024
e5f05bf
Add last_parsed_file_hash column to feed table
mitchdowney Sep 1, 2024
336c3bc
Fix item_chapter column name id_text
mitchdowney Sep 1, 2024
15bb606
Remove item_chapter_image table
mitchdowney Sep 1, 2024
868ae77
Update feed_log
mitchdowney Sep 1, 2024
4a30352
Add podverse_queue and podverse_workers to docker compose
mitchdowney Sep 6, 2024
908d3d7
Rename podverse_queue to podverse_amqp
mitchdowney Sep 7, 2024
a540f55
Remove podverse_workers from makefile
mitchdowney Sep 7, 2024
a38ae57
Change podverse_queue to podverse_amqp
mitchdowney Sep 7, 2024
4b51c3e
Add podverse_network to docker-compose file
mitchdowney Sep 7, 2024
9e9d519
Add podverse_workers_debug
mitchdowney Sep 7, 2024
d206bac
Add npm-link-modules.sh and add example env files
mitchdowney Sep 8, 2024
f5876b5
Add dev/local-dev-setup.md; Attach init_database.sql file to podverse…
mitchdowney Sep 8, 2024
c73a129
Update env examples; update npm-link-modules.sh; update docker-compos…
mitchdowney Sep 9, 2024
0f90c1c
Update npm-link-modules.sh
mitchdowney Sep 9, 2024
dc82f5a
Add foreign key indexes
mitchdowney Sep 19, 2024
250e6dd
Add comments to npm-link-modules.sh
mitchdowney Sep 19, 2024
608c460
Update npm-link-modules
mitchdowney Sep 21, 2024
bf2403f
Fix OneToOne unique relationships; add indexes to remote_item tables
mitchdowney Sep 21, 2024
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
1,219 changes: 1,219 additions & 0 deletions database/combined/init_database.sql

Large diffs are not rendered by default.

36 changes: 36 additions & 0 deletions database/migrations/0000_init_helpers.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
-- 0000 migration

-- Helpers

-- In the previous version of the app, short_id was 7-14 characters long.
-- To make migration to v2 easier, we will use a 15 character long short_id,
-- so we can easily distinguish between v1 and v2 short_ids.
CREATE DOMAIN short_id_v2 AS VARCHAR(15);

CREATE DOMAIN varchar_short AS VARCHAR(50);
CREATE DOMAIN varchar_normal AS VARCHAR(255);
CREATE DOMAIN varchar_long AS VARCHAR(2500);

CREATE DOMAIN varchar_email AS VARCHAR(255) CHECK (VALUE ~ '^.+@.+\..+$');
CREATE DOMAIN varchar_fqdn AS VARCHAR(253);
CREATE DOMAIN varchar_guid AS VARCHAR(36);
CREATE DOMAIN varchar_password AS VARCHAR(36);
CREATE DOMAIN varchar_slug AS VARCHAR(100);
CREATE DOMAIN varchar_uri AS VARCHAR(2083);

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I mention in a previous comment about being consistent with data types. You are creating a domain here for url, using varchar. However, I know I saw at least one or two url columns using TEXT as the datatype. Again, neither options are incorrect-I think it would just bode well to try and stay as consistent as possible with your table structures and the data types you are using.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree. At the moment I'm not sure which columns I missed with the varchar_url, but I do want to use that domain for all url columns.

CREATE DOMAIN varchar_url AS VARCHAR(2083) CHECK (VALUE ~ '^https?://|^http?://');

CREATE DOMAIN server_time AS BIGINT;
CREATE DOMAIN server_time_with_default AS BIGINT DEFAULT EXTRACT(EPOCH FROM NOW());

CREATE DOMAIN media_player_time AS NUMERIC(10, 2);
CREATE DOMAIN list_position AS NUMERIC(22, 21);
CREATE DOMAIN numeric_20_11 AS NUMERIC(20, 11);

-- Function to set created_at and updated_at
CREATE OR REPLACE FUNCTION set_updated_at_field()
RETURNS TRIGGER AS $$
BEGIN
NEW.updated_at := EXTRACT(EPOCH FROM NOW());
RETURN NEW;
END;
$$ LANGUAGE plpgsql;
Loading