Skip to content

Commit

Permalink
FIX: SQLite Syntax Errors Failed Plugin Installation
Browse files Browse the repository at this point in the history
- fixes #6 - thanks @PopovIG
  • Loading branch information
aljawaid committed Jul 3, 2023
1 parent 9b8eb89 commit 98defb9
Showing 1 changed file with 6 additions and 9 deletions.
15 changes: 6 additions & 9 deletions Schema/Sqlite.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,34 +10,31 @@ function version_1(PDO $pdo)
{
/* CREATE DYNAMIC ITEMS FOR ONE GENERAL CONTACT - ITEM TYPE WILL BE VALIDATED IN FRONTEND */
$pdo->exec('CREATE TABLE IF NOT EXISTS address_book_contacts_items (
id INT NOT NULL AUTO_INCREMENT,
id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL,
item VARCHAR(30) NOT NULL,
item_help TEXT,
item_type TEXT NOT NULL,
property_set TEXT,
position INT NOT NULL,
PRIMARY KEY(id)
position INT NOT NULL
)');

/* SAVE VALUES OF DYNAMIC ITEMS FOR THE CONTACT */
$pdo->exec('CREATE TABLE IF NOT EXISTS address_book_contacts_contact (
contacts_id INT NOT NULL,
contacts_id INTEGER KEY NOT NULL,
item_id INT NOT NULL,
contact_item_value TEXT NOT NULL,
updated_by_user_id INT NOT NULL,
last_updated INTEGER NOT NULL,
FOREIGN KEY(item_id) REFERENCES address_book_contacts_items(id) ON DELETE CASCADE,
KEY(contacts_id)
FOREIGN KEY(item_id) REFERENCES address_book_contacts_items(id) ON DELETE CASCADE
)');

/* CREATE LINKS TO TASKS WITH CONTACTS */
$pdo->exec('CREATE TABLE IF NOT EXISTS address_book_contacts_task_has_contact (
id INT NOT NULL AUTO_INCREMENT,
id INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
task_id INT NOT NULL,
contacts_id INT NOT NULL,
FOREIGN KEY(contacts_id) REFERENCES address_book_contacts_contact(contacts_id) ON DELETE CASCADE,
FOREIGN KEY(task_id) REFERENCES tasks(id) ON DELETE CASCADE,
PRIMARY KEY(id)
FOREIGN KEY(task_id) REFERENCES tasks(id) ON DELETE CASCADE
)');

/* ADD DEFAULTS FOR CONTACT ITEMS */
Expand Down

0 comments on commit 98defb9

Please sign in to comment.