-
Notifications
You must be signed in to change notification settings - Fork 36
Big plans: Drop old tables, migrate to new schema/structure #318
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
Merged
Merged
Changes from all commits
Commits
Show all changes
38 commits
Select commit
Hold shift + click to select a range
0fb1948
WIP: Big Plans
erskingardner 6f279e1
WIP: Update event processor methods
erskingardner d857fbe
More WIP refactoring
erskingardner 260217c
WIP: Fix some linters
erskingardner 0768806
Remove spawn_blocking
erskingardner ed373f3
WIP: FIxed all linter errors
erskingardner 2447b54
chore(nostr_manager): remove unused import
jgmontoya 77204a3
Fix warnings, move follows, update int-test
erskingardner 0f4535e
WIP: Updates
erskingardner 0bbae8a
create_new_account flow fixed
erskingardner 1cdba9b
Fix login and clean up relay setup
erskingardner 970c71a
Fix strange follows method
erskingardner 87cf945
Refactor database methods to take only a database param, not whitenoise
erskingardner 5ad3c69
remove triggers, background fetch using event handlers, fix update me…
erskingardner e1dd63a
feat(database/utils): add database utils with parse_timestamp method
jgmontoya fed44bf
fix(database/users): return persisted user on .find_by_pubkey
jgmontoya a276005
fix(database/follows): use find_or_create on Whitenoise#follow_users
jgmontoya 3a45cf9
fix(integration_test): use pubkeys to verify final accounts state
jgmontoya e9423b0
refactor & fix Database#delete_all_data: now drops every table and re…
jgmontoya 07b6e26
use find or create on relays to ensure they're properly persisted in …
jgmontoya 1c6be74
refactor(accounts/core): split relay setup logic for new vs existing …
jgmontoya a7cf558
test(): fix doc-tests
jgmontoya ec3d3e4
integration test: replace .await? with .await.unwrap()
jgmontoya 5b91398
fix(db_migrations/0007_drop_old_tables): ignore potential existing se…
jgmontoya 4d6dbac
chore(nostr_manager/search): remove dead code
jgmontoya 0fe6d0d
feat(accounts): publish metadata on #update_metadata
jgmontoya bebefbb
refactor(accounts/core): improve error handling and timestamp consist…
jgmontoya 8708d49
refactor(accounts): replace unwrap() with proper error handling on gr…
jgmontoya cc00ed1
fix(accounts/welcomes): use find_or_create_by_url for relay lookup
jgmontoya 3337aef
fix(database/accounts): stop throwing error when empty account table …
jgmontoya 002c4da
fix(database/app_settings): improve error handling in .find_or_create…
jgmontoya 68005b8
fix(database/relays): fix transaction safety and dangling references
jgmontoya 608f859
fix(database/user_relays): better handle invalid RelayType values
jgmontoya 24747e4
fix(database/user_relays): use single-connection SQLite pool for in-m…
jgmontoya e02728d
fix(database/users): improve error handling and remove_relay robustness
jgmontoya 05cf570
fix(database/utils): improve timestamp parsing robustness and test re…
jgmontoya 7a54e51
refactor(event_processor): replace unwrap() of Account::create_nostr_…
jgmontoya 15eaa04
fix(database): preserve error provenance and validate user persistance
jgmontoya File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,25 @@ | ||
| CREATE TABLE IF NOT EXISTS app_settings ( | ||
| id INTEGER PRIMARY KEY CHECK (id = 1), -- Only one row allowed with id=1 | ||
| theme_mode TEXT NOT NULL DEFAULT 'system', | ||
| created_at DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP, | ||
| updated_at DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP | ||
| ); | ||
|
|
||
| -- Insert default app settings row with system theme | ||
| INSERT OR IGNORE INTO app_settings (theme_mode) VALUES ('system'); | ||
|
|
||
| -- Trigger to automatically update updated_at field on row updates | ||
| CREATE TRIGGER update_app_settings_updated_at | ||
| AFTER UPDATE ON app_settings | ||
| FOR EACH ROW | ||
| BEGIN | ||
| UPDATE app_settings SET updated_at = CURRENT_TIMESTAMP WHERE id = NEW.id; | ||
| END; | ||
|
|
||
|
|
||
| DROP TABLE IF EXISTS accounts; | ||
| DROP TABLE IF EXISTS contacts; | ||
|
|
||
| ALTER TABLE accounts_new RENAME TO accounts; | ||
|
|
||
| ALTER TABLE accounts DROP COLUMN settings; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,4 @@ | ||
| -- Add unique constraint to account_follows table to prevent duplicate follows | ||
| -- This constraint ensures that an account can only follow a user once | ||
| CREATE UNIQUE INDEX IF NOT EXISTS idx_account_follows_unique | ||
| ON account_follows(account_id, user_id); | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,11 @@ | ||
| -- Remove all automatic updated_at triggers to prevent recursion | ||
| -- The application code will handle updating timestamps manually | ||
|
|
||
| -- Drop all existing updated_at triggers | ||
| DROP TRIGGER IF EXISTS update_users_updated_at; | ||
| DROP TRIGGER IF EXISTS update_accounts_new_updated_at; | ||
| DROP TRIGGER IF EXISTS update_accounts_updated_at; | ||
| DROP TRIGGER IF EXISTS update_account_follows_updated_at; | ||
| DROP TRIGGER IF EXISTS update_relays_updated_at; | ||
| DROP TRIGGER IF EXISTS update_user_relays_updated_at; | ||
| DROP TRIGGER IF EXISTS update_app_settings_updated_at; |
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.