masterrecord 0.0.22 → 0.0.24
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/Entity/EntityModel.js +128 -120
- package/Entity/EntityModelBuilder.js +63 -63
- package/Entity/EntityTrackerModel.js +42 -42
- package/Masterrecord.js +173 -178
- package/Migrations/cli.js +105 -105
- package/Migrations/migrationTemplate.js +63 -63
- package/Migrations/migrations.js +46 -22
- package/Migrations/schema.js +42 -42
- package/QueryLanguage/_Expression.js +321 -321
- package/QueryLanguage/_LogicalQuery.js +22 -22
- package/QueryLanguage/_OperatorList.js +87 -87
- package/QueryLanguage/_QueryModel.js +441 -441
- package/QueryLanguage/_Tokenization.js +172 -172
- package/QueryLanguage/__Query.js +385 -385
- package/QueryLanguage/_simpleQuery.js +183 -183
- package/QueryLanguage/queryBuilder.js +51 -51
- package/{SQLEngine.js → SQLiteEngine.js} +56 -52
- package/Tools.js +55 -55
- package/package.json +27 -27
|
@@ -1,64 +1,64 @@
|
|
|
1
|
-
var Schema = require('./schema');
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
// https://channel9.msdn.com/Blogs/EF/Migrations-Under-the-Hood
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
// migration Logic
|
|
8
|
-
// using the command line run the command - "add migration 'name' 'context file location' ";
|
|
9
|
-
// this will call the context which will return on object of entities
|
|
10
|
-
// then call the previous migration and pass that model object and the context object to the EDMModelDiffer
|
|
11
|
-
// the EDMModelDiffer function to calculate database changes
|
|
12
|
-
// EDMModelDiffer will return only database changes model that have not been implemented already
|
|
13
|
-
// we then create the miration using function 'migrationCodeGenerator' based on the model that was provided by EDMModelDiffer
|
|
14
|
-
// js date stamp Date.now()
|
|
15
|
-
|
|
16
|
-
class Migration extends Schema {
|
|
17
|
-
|
|
18
|
-
constructor() {
|
|
19
|
-
super();
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
static up(){
|
|
23
|
-
|
|
24
|
-
this.createTable("user", {
|
|
25
|
-
id : {
|
|
26
|
-
type : "integer",
|
|
27
|
-
primary : true,
|
|
28
|
-
unique : true,
|
|
29
|
-
nullable : false
|
|
30
|
-
},
|
|
31
|
-
user_id : {
|
|
32
|
-
type : "integer",
|
|
33
|
-
required : true, // SQL Data Constraints
|
|
34
|
-
foreignKey : "user" // SQL Data Constraints
|
|
35
|
-
},
|
|
36
|
-
website_url : {
|
|
37
|
-
type : "string",
|
|
38
|
-
required : true,
|
|
39
|
-
maxLength : 60
|
|
40
|
-
},
|
|
41
|
-
website_type : {
|
|
42
|
-
type : "string",
|
|
43
|
-
required : true
|
|
44
|
-
}
|
|
45
|
-
});
|
|
46
|
-
|
|
47
|
-
this.addColumn("blog", "url", {
|
|
48
|
-
type : "string",
|
|
49
|
-
required : true
|
|
50
|
-
});
|
|
51
|
-
|
|
52
|
-
this.done();
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
static down(){
|
|
56
|
-
this.dropTable("user");
|
|
57
|
-
|
|
58
|
-
this.dropColumn("blog", "url");
|
|
59
|
-
|
|
60
|
-
this.done();
|
|
61
|
-
}
|
|
62
|
-
}
|
|
63
|
-
|
|
1
|
+
var Schema = require('./schema');
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
// https://channel9.msdn.com/Blogs/EF/Migrations-Under-the-Hood
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
// migration Logic
|
|
8
|
+
// using the command line run the command - "add migration 'name' 'context file location' ";
|
|
9
|
+
// this will call the context which will return on object of entities
|
|
10
|
+
// then call the previous migration and pass that model object and the context object to the EDMModelDiffer
|
|
11
|
+
// the EDMModelDiffer function to calculate database changes
|
|
12
|
+
// EDMModelDiffer will return only database changes model that have not been implemented already
|
|
13
|
+
// we then create the miration using function 'migrationCodeGenerator' based on the model that was provided by EDMModelDiffer
|
|
14
|
+
// js date stamp Date.now()
|
|
15
|
+
|
|
16
|
+
class Migration extends Schema {
|
|
17
|
+
|
|
18
|
+
constructor() {
|
|
19
|
+
super();
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
static up(){
|
|
23
|
+
|
|
24
|
+
this.createTable("user", {
|
|
25
|
+
id : {
|
|
26
|
+
type : "integer",
|
|
27
|
+
primary : true,
|
|
28
|
+
unique : true,
|
|
29
|
+
nullable : false
|
|
30
|
+
},
|
|
31
|
+
user_id : {
|
|
32
|
+
type : "integer",
|
|
33
|
+
required : true, // SQL Data Constraints
|
|
34
|
+
foreignKey : "user" // SQL Data Constraints
|
|
35
|
+
},
|
|
36
|
+
website_url : {
|
|
37
|
+
type : "string",
|
|
38
|
+
required : true,
|
|
39
|
+
maxLength : 60
|
|
40
|
+
},
|
|
41
|
+
website_type : {
|
|
42
|
+
type : "string",
|
|
43
|
+
required : true
|
|
44
|
+
}
|
|
45
|
+
});
|
|
46
|
+
|
|
47
|
+
this.addColumn("blog", "url", {
|
|
48
|
+
type : "string",
|
|
49
|
+
required : true
|
|
50
|
+
});
|
|
51
|
+
|
|
52
|
+
this.done();
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
static down(){
|
|
56
|
+
this.dropTable("user");
|
|
57
|
+
|
|
58
|
+
this.dropColumn("blog", "url");
|
|
59
|
+
|
|
60
|
+
this.done();
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
|
|
64
64
|
module.exports = Migration;
|
package/Migrations/migrations.js
CHANGED
|
@@ -1,23 +1,47 @@
|
|
|
1
|
-
// version 1
|
|
2
|
-
var fs = require('fs');
|
|
3
|
-
// https://blog.tekspace.io/code-first-multiple-db-context-migration/
|
|
4
|
-
|
|
5
|
-
// node masterrecord add-migration josh C:\Users\rbatista\Downloads\kollege\freshmen\app\models\context
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
1
|
+
// version 1
|
|
2
|
+
var fs = require('fs');
|
|
3
|
+
// https://blog.tekspace.io/code-first-multiple-db-context-migration/
|
|
4
|
+
|
|
5
|
+
// node masterrecord add-migration josh C:\Users\rbatista\Downloads\kollege\freshmen\app\models\context
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
/*
|
|
10
|
+
SQLITE CREATE MIGRATIONS
|
|
11
|
+
CREATE TABLE "user" (
|
|
12
|
+
"id" INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT UNIQUE,
|
|
13
|
+
"auth_id" INTEGER NOT NULL,
|
|
14
|
+
"view_counter" INTEGER NOT NULL DEFAULT 0,
|
|
15
|
+
"background_image_id" INTEGER NOT NULL,
|
|
16
|
+
"profile_image_id" INTEGER NOT NULL,
|
|
17
|
+
"full_name" TEXT NOT NULL,
|
|
18
|
+
"languages" TEXT,
|
|
19
|
+
"profile_email" TEXT,
|
|
20
|
+
"phone_number" TEXT,
|
|
21
|
+
"birthmonth" TEXT,
|
|
22
|
+
"birthday" TEXT,
|
|
23
|
+
"created_at" TEXT,
|
|
24
|
+
"updated_at" TEXT
|
|
25
|
+
);
|
|
26
|
+
|
|
27
|
+
*/
|
|
28
|
+
|
|
29
|
+
class Migrations{
|
|
30
|
+
// SQL Lite doesnt have a date so please use TEXT fields;
|
|
31
|
+
|
|
32
|
+
EDMModelDiffer(snapShot, contextModel){
|
|
33
|
+
|
|
34
|
+
// do a diff and return only diff fields
|
|
35
|
+
// if table doesnt exist then add a create database object.
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
migrationCodeGenerator(name, column, migrationDate){
|
|
39
|
+
// will create migration file with data needed
|
|
40
|
+
// using the migration template
|
|
41
|
+
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
}
|
|
46
|
+
|
|
23
47
|
module.exports = Migrations;
|
package/Migrations/schema.js
CHANGED
|
@@ -1,43 +1,43 @@
|
|
|
1
|
-
// version 1
|
|
2
|
-
var fs = require('fs');
|
|
3
|
-
|
|
4
|
-
class Schema{
|
|
5
|
-
|
|
6
|
-
// create obj to convert into create sql
|
|
7
|
-
addColumn(tableName, columnName, ){
|
|
8
|
-
|
|
9
|
-
// add column to database
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
dropColumn(tableName, columnName){
|
|
13
|
-
// drop column
|
|
14
|
-
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
createTable(name, columns){
|
|
18
|
-
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
dropTable(name){
|
|
22
|
-
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
// will get the data and create the file
|
|
26
|
-
done(){
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
/*
|
|
34
|
-
up and down function..
|
|
35
|
-
on commmand line call of run migrations with folder location of context. it will
|
|
36
|
-
load context and all the objects.
|
|
37
|
-
it will then match objects with migration data.
|
|
38
|
-
if it's a new item it will generate a new migration dependent on what comes from migration.
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
*/
|
|
42
|
-
|
|
1
|
+
// version 1
|
|
2
|
+
var fs = require('fs');
|
|
3
|
+
|
|
4
|
+
class Schema{
|
|
5
|
+
|
|
6
|
+
// create obj to convert into create sql
|
|
7
|
+
addColumn(tableName, columnName, ){
|
|
8
|
+
|
|
9
|
+
// add column to database
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
dropColumn(tableName, columnName){
|
|
13
|
+
// drop column
|
|
14
|
+
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
createTable(name, columns){
|
|
18
|
+
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
dropTable(name){
|
|
22
|
+
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
// will get the data and create the file
|
|
26
|
+
done(){
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
/*
|
|
34
|
+
up and down function..
|
|
35
|
+
on commmand line call of run migrations with folder location of context. it will
|
|
36
|
+
load context and all the objects.
|
|
37
|
+
it will then match objects with migration data.
|
|
38
|
+
if it's a new item it will generate a new migration dependent on what comes from migration.
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
*/
|
|
42
|
+
|
|
43
43
|
module.exports = Schema;
|