Skip to content
Snippets Groups Projects
Commit 3dfa84be authored by Erik Johnston's avatar Erik Johnston
Browse files

Convert im schema to a 'one' table structure

parent 08ed4ccf
No related branches found
No related tags found
No related merge requests found
...@@ -12,43 +12,48 @@ ...@@ -12,43 +12,48 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
CREATE TABLE IF NOT EXISTS rooms(
room_id TEXT PRIMARY KEY NOT NULL, CREATE TABLE IF NOT EXISTS events(
is_public INTEGER, ordering INTEGER PRIMARY KEY AUTOINCREMENT,
creator TEXT event_id TEXT NOT NULL,
event_type TEXT NOT NULL,
sender TEXT,
room_id TEXT,
content TEXT,
unrecognized_keys TEXT
); );
CREATE TABLE IF NOT EXISTS room_memberships( CREATE TABLE IF NOT EXISTS state_events(
id INTEGER PRIMARY KEY AUTOINCREMENT, event_id TEXT NOT NULL,
user_id TEXT NOT NULL, -- no foreign key to users table, it could be an id belonging to another home server
sender TEXT NOT NULL,
room_id TEXT NOT NULL, room_id TEXT NOT NULL,
membership TEXT NOT NULL, event_type TEXT NOT NULL,
content TEXT NOT NULL state_key TEXT NOT NULL,
prev_state TEXT
); );
CREATE TABLE IF NOT EXISTS messages( CREATE TABLE IF NOT EXISTS current_state(
id INTEGER PRIMARY KEY AUTOINCREMENT, event_id TEXT NOT NULL,
user_id TEXT, room_id TEXT NOT NULL,
room_id TEXT, );
msg_id TEXT,
content TEXT CREATE TABLE IF NOT EXISTS room_memberships(
event_id TEXT NOT NULL,
user_id TEXT NOT NULL,
sender TEXT NOT NULL,
room_id TEXT NOT NULL,
membership TEXT NOT NULL
); );
CREATE TABLE IF NOT EXISTS feedback( CREATE TABLE IF NOT EXISTS feedback(
id INTEGER PRIMARY KEY AUTOINCREMENT, event_id TEXT NOT NULL,
content TEXT,
feedback_type TEXT, feedback_type TEXT,
fb_sender_id TEXT, fb_sender_id TEXT,
msg_id TEXT,
room_id TEXT, room_id TEXT,
msg_sender_id TEXT content TEXT
); );
CREATE TABLE IF NOT EXISTS room_data( CREATE TABLE IF NOT EXISTS rooms(
id INTEGER PRIMARY KEY AUTOINCREMENT, room_id TEXT PRIMARY KEY NOT NULL,
room_id TEXT NOT NULL, is_public INTEGER,
type TEXT NOT NULL, creator TEXT
state_key TEXT NOT NULL,
content TEXT
); );
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment