u
This commit is contained in:
@@ -19,7 +19,7 @@ function parseSchema(source) {
|
||||
const initName = initMatch[1];
|
||||
const sqlBlock = initMatch[2];
|
||||
|
||||
const createRegex = /CREATE TABLE\s+(\w+)\s*\(([\s\S]*?)\);/gi;
|
||||
const createRegex = /CREATE TABLE\s+\[?(\w+)\]?\s*\(([\s\S]*?)\);/gi;
|
||||
let createMatch;
|
||||
|
||||
while ((createMatch = createRegex.exec(sqlBlock)) !== null) {
|
||||
@@ -89,7 +89,7 @@ function parseSchema(source) {
|
||||
}
|
||||
|
||||
const alterAddColumnRegex =
|
||||
/ALTER TABLE\s+(\w+)\s+ADD\s+(\w+)\s+([\w]+(?:\([^)]*\))?)(?:\s+(NOT NULL|NULL))?\s*;/gi;
|
||||
/ALTER TABLE\s+\[?(\w+)\]?\s+ADD\s+\[?(\w+)\]?\s+([\w]+(?:\([^)]*\))?)(?:\s+(NOT NULL|NULL))?\s*;/gi;
|
||||
let alterColumnMatch;
|
||||
|
||||
while ((alterColumnMatch = alterAddColumnRegex.exec(sqlBlock)) !== null) {
|
||||
@@ -105,7 +105,7 @@ function parseSchema(source) {
|
||||
}
|
||||
|
||||
const alterFkRegex =
|
||||
/ALTER TABLE\s+(\w+)\s+ADD CONSTRAINT\s+(\w+)\s+FOREIGN KEY\s*\(([^)]+)\)\s+REFERENCES\s+\[?(\w+)\]?\(([^)]+)\)(?:\s+ON DELETE\s+([\w\s]+?))?\s*;/gi;
|
||||
/ALTER TABLE\s+\[?(\w+)\]?\s+ADD CONSTRAINT\s+(\w+)\s+FOREIGN KEY\s*\(([^)]+)\)\s+REFERENCES\s+\[?(\w+)\]?\(([^)]+)\)(?:\s+ON DELETE\s+([\w\s]+?))?\s*;/gi;
|
||||
let alterMatch;
|
||||
|
||||
while ((alterMatch = alterFkRegex.exec(sqlBlock)) !== null) {
|
||||
|
||||
Reference in New Issue
Block a user