mirror of
https://code.mensbeam.com/MensBeam/Arsse.git
synced 2024-12-22 21:22:40 +00:00
Law out the plan for the new schema
This commit is contained in:
parent
d54733ad98
commit
3e2fce3129
1 changed files with 45 additions and 0 deletions
45
sql/SQLite3/7.sql
Normal file
45
sql/SQLite3/7.sql
Normal file
|
@ -0,0 +1,45 @@
|
|||
-- SPDX-License-Identifier: MIT
|
||||
-- Copyright 2017 J. King, Dustin Wilson et al.
|
||||
-- See LICENSE and AUTHORS files for details
|
||||
|
||||
-- Create a temporary table mapping old article IDs to new article IDs per-user.
|
||||
-- This will have the result of every article ID being new, which will make the initial sync painful,
|
||||
-- but it will avoid potential weird behaviour
|
||||
create table arsse_articles_map(
|
||||
article int not null,
|
||||
subscription int not null,
|
||||
id integer primary key autoincrement
|
||||
);
|
||||
insert into arsse_articles_map(article, subscription) values(1,1);
|
||||
delete from arsse_articles_map;
|
||||
update sqlite_sequence set seq = (select max(id) from arsse_articles) where name = 'arsse_articles_map';
|
||||
insert into arsse_articles_map(article, subscription)
|
||||
select arsse_articles.id as article, arsse_subscriptions.id as subscription from arsse_articles cross join arsse_subscriptions using(feed);
|
||||
|
||||
-- Perform a similar reset for editions
|
||||
create table arsse_editions_temp(
|
||||
id integer primary key autoincrement,
|
||||
article integer
|
||||
);
|
||||
insert into arsse_editions_temp values(1,1);
|
||||
delete from arsse_editions_temp;
|
||||
update sqlite_sequence set seq = (select max(id) from arsse_editions) where name = 'arsse_editions_temp';
|
||||
insert into arsse_editions_temp(article) select id from arsse_articles_map;
|
||||
|
||||
-- Create a new articles table which combines the marks table
|
||||
|
||||
-- Create a new table to hold article content
|
||||
|
||||
-- Fix up the enclosures table
|
||||
|
||||
-- Fix up the label members table
|
||||
|
||||
-- Rebuild the editions table
|
||||
|
||||
-- Create a new subscriptions table which combines the feeds table
|
||||
|
||||
-- Fix up the tag members table
|
||||
|
||||
-- Fix up the icons table
|
||||
|
||||
-- Delete the old tables and rename the new ones
|
Loading…
Reference in a new issue