From d5eb713888715e8f18d2ccf508a8eb0b1a483ad1 Mon Sep 17 00:00:00 2001
From: wei <>
Date: Tue, 24 Apr 2007 06:14:56 +0000
Subject: add active record Relations

---
 tests/simple_unit/ActiveRecord/sqlite.sql | 46 +++++++++++++++++++++++++++++++
 1 file changed, 46 insertions(+)
 create mode 100644 tests/simple_unit/ActiveRecord/sqlite.sql

(limited to 'tests/simple_unit/ActiveRecord/sqlite.sql')

diff --git a/tests/simple_unit/ActiveRecord/sqlite.sql b/tests/simple_unit/ActiveRecord/sqlite.sql
new file mode 100644
index 00000000..03e4a1ab
--- /dev/null
+++ b/tests/simple_unit/ActiveRecord/sqlite.sql
@@ -0,0 +1,46 @@
+CREATE TABLE album (
+  title varchar(100) NOT NULL PRIMARY KEY
+);
+
+CREATE TABLE artist (
+  name varchar(25) NOT NULL PRIMARY KEY
+);
+
+CREATE TABLE album_artists (
+  album_title varchar(100) NOT NULL CONSTRAINT fk_album REFERENCES album(title) ON DELETE CASCADE,
+  artist_name varchar(25) NOT NULL CONSTRAINT fk_artist REFERENCES artist(name) ON DELETE CASCADE
+);
+
+CREATE TABLE track (
+  id INTEGER NOT NULL PRIMARY KEY,
+  song_name varchar(200) NOT NULL default '',
+  album_id varchar(100) NOT NULL CONSTRAINT fk_album_1 REFERENCES album(title) ON DELETE CASCADE
+);
+
+CREATE TABLE cover(
+	album varchar(200) NOT NULL CONSTRAINT fk_album_2 REFERENCES album(title) ON DELETE CASCADE,
+	content text
+);
+
+INSERT INTO album (title) VALUES ('Album 1');
+INSERT INTO album (title) VALUES ('Album 2');
+
+INSERT INTO cover(album,content) VALUES ('Album 1', 'lalala');
+INSERT INTO cover(album,content) VALUES ('Album 2', 'conver content');
+
+INSERT INTO artist (name) VALUES ('Dan');
+INSERT INTO artist (name) VALUES ('Jenny');
+INSERT INTO artist (name) VALUES ('Karl');
+INSERT INTO artist (name) VALUES ('Tom');
+
+INSERT INTO album_artists (album_title, artist_name) VALUES ('Album 1', 'Dan');
+INSERT INTO album_artists (album_title, artist_name) VALUES ('Album 2', 'Dan');
+INSERT INTO album_artists (album_title, artist_name) VALUES ('Album 1', 'Jenny');
+INSERT INTO album_artists (album_title, artist_name) VALUES ('Album 2', 'Karl');
+INSERT INTO album_artists (album_title, artist_name) VALUES ('Album 2', 'Tom');
+
+INSERT INTO track (id, song_name, album_id) VALUES (1, 'Track 1', 'Album 1');
+INSERT INTO track (id, song_name, album_id) VALUES (2, 'Song 2', 'Album 1');
+INSERT INTO track (id, song_name, album_id) VALUES (3, 'Track A', 'Album 2');
+INSERT INTO track (id, song_name, album_id) VALUES (4, 'Track B', 'Album 2');
+INSERT INTO track (id, song_name, album_id) VALUES (5, 'Song 3', 'Album 1');
\ No newline at end of file
-- 
cgit v1.2.3

