-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
new test script for an association table with a unique association an…
…d some other columns
- Loading branch information
Showing
5 changed files
with
270 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
var dataUtils = require('./../import.js'); | ||
var Catalog = require('./../model/catalog.js'); | ||
|
||
var configuration = { | ||
setup: { | ||
"catalog": {}, | ||
"schema": { | ||
"name": "edit_w_association", | ||
"createNew": true, | ||
"path": "schema/edit_w_association.json" | ||
}, | ||
"tables": { | ||
"createNew": true | ||
}, | ||
"entities": { | ||
"createNew": true, | ||
"path": "data/edit_w_association" | ||
} | ||
}, | ||
url: process.env.ERMREST_URL, | ||
authCookie: process.env.AUTH_COOKIE, | ||
cleanup: false | ||
}; | ||
|
||
dataUtils.importData(configuration).then(function(data) { | ||
console.log("Data imported with catalogId " + data.catalogId); | ||
console.log("Please remember to clean up the catalog."); | ||
|
||
// Anyone in "isrd-staff" can read ACL | ||
// return Catalog.addACLs(data.schema.url, data.catalogId, {"select": ["https://auth.globus.org/176baec4-ed26-11e5-8e88-22000ab4b42b"]}); | ||
// Anyone can read ACL | ||
return Catalog.addACLs(data.schema.url, data.catalogId, {"select": ["*"]}); | ||
}, function(err) { | ||
console.log("Unable to import data"); | ||
console.dir(err); | ||
}).then(function(data) { | ||
console.log("ACLs set"); | ||
}, function(err) { | ||
console.log("Unable to set ACLs"); | ||
console.dir(err); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
[{"id": 1, "order": 2, "fk_to_main": "experiment_1", "fk_to_leaf": "name_2"}] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
[{"id": 1, "col_for_association": "name_1"}, | ||
{"id": 2, "col_for_association": "name_2"}, | ||
{"id": 3, "col_for_association": "name_3"}, | ||
{"id": 4, "col_for_association": "name_4"}, | ||
{"id": 5, "col_for_association": "name_5"}, | ||
{"id": 6, "col_for_association": "name_6"}, | ||
{"id": 7, "col_for_association": "name_7"}, | ||
{"id": 8, "col_for_association": "name_8"}, | ||
{"id": 9, "col_for_association": "name_9"}, | ||
{"id": 10, "col_for_association": "name_10"}] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
[{"id": 1, "col_for_association": "experiment_1"}, | ||
{"id": 2, "col_for_association": "experiment_2"}, | ||
{"id": 3, "col_for_association": "experiment_3"}, | ||
{"id": 4, "col_for_association": "experiment_4"}, | ||
{"id": 5, "col_for_association": "experiment_5"}] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,213 @@ | ||
{ | ||
"schema_name": "edit_w_association", | ||
"tables": { | ||
"main": { | ||
"kind": "table", | ||
"schema_name": "edit_w_association", | ||
"table_name": "main", | ||
"keys": [ | ||
{ | ||
"unique_columns": [ | ||
"id" | ||
] | ||
}, | ||
{ | ||
"unique_columns": [ | ||
"col_for_association" | ||
] | ||
} | ||
], | ||
"column_definitions": [ | ||
{ | ||
"name": "id", | ||
"nullok": false, | ||
"type": { | ||
"typename": "text" | ||
} | ||
}, | ||
{ | ||
"name": "col_for_association", | ||
"type": { | ||
"typename": "text" | ||
} | ||
} | ||
], | ||
"annotations": { | ||
"tag:isrd.isi.edu,2016:visible-columns": { | ||
"detailed": [ | ||
"id", "col_for_association", "RID" | ||
] | ||
} | ||
} | ||
}, | ||
"association": { | ||
"kind": "table", | ||
"schema_name": "edit_w_association", | ||
"table_name": "association", | ||
"column_definitions": [ | ||
{ | ||
"name": "id", | ||
"nullok": false, | ||
"type": { | ||
"typename": "serial4" | ||
} | ||
}, | ||
{ | ||
"name": "order", | ||
"default": 1, | ||
"type": { | ||
"typename": "int4" | ||
} | ||
}, | ||
{ | ||
"name": "fk_to_leaf", | ||
"nullok": false, | ||
"type": { | ||
"typename": "text" | ||
} | ||
}, | ||
{ | ||
"name": "fk_to_main", | ||
"nullok": false, | ||
"type": { | ||
"typename": "text" | ||
} | ||
} | ||
], | ||
"keys": [ | ||
{ | ||
"unique_columns": [ | ||
"id" | ||
] | ||
}, | ||
{ | ||
"unique_columns": [ | ||
"fk_to_main", | ||
"fk_to_leaf" | ||
] | ||
} | ||
], | ||
"foreign_keys": [ | ||
{ | ||
"RID": "14-381J", | ||
"foreign_key_columns": [ | ||
{ | ||
"schema_name": "edit_w_association", | ||
"table_name": "association", | ||
"column_name": "fk_to_leaf" | ||
} | ||
], | ||
"referenced_columns": [ | ||
{ | ||
"schema_name": "edit_w_association", | ||
"table_name": "leaf", | ||
"column_name": "col_for_association" | ||
} | ||
], | ||
"names": [ | ||
[ | ||
"edit_w_association", | ||
"leaf_fkey" | ||
] | ||
] | ||
}, | ||
{ | ||
"foreign_key_columns": [ | ||
{ | ||
"schema_name": "edit_w_association", | ||
"table_name": "association", | ||
"column_name": "fk_to_main" | ||
} | ||
], | ||
"referenced_columns": [ | ||
{ | ||
"schema_name": "edit_w_association", | ||
"table_name": "main", | ||
"column_name": "col_for_association" | ||
} | ||
], | ||
"names": [ | ||
[ | ||
"edit_w_association", | ||
"main_fkey" | ||
] | ||
] | ||
} | ||
], | ||
"annotations": { | ||
"tag:isrd.isi.edu,2016:visible-columns": { | ||
"entry": [ | ||
"order", | ||
[ | ||
"edit_w_association", | ||
"leaf_fkey" | ||
], | ||
[ | ||
"edit_w_association", | ||
"main_fkey" | ||
] | ||
], | ||
"compact": [ | ||
"order", | ||
[ | ||
"edit_w_association", | ||
"main_fkey" | ||
], | ||
[ | ||
"edit_w_association", | ||
"leaf_fkey" | ||
] | ||
], | ||
"detailed": "compact" | ||
} | ||
} | ||
}, | ||
"leaf": { | ||
"kind": "table", | ||
"schema_name": "edit_w_association", | ||
"table_name": "leaf", | ||
"keys": [ | ||
{ | ||
"unique_columns": [ | ||
"id" | ||
] | ||
}, | ||
{ | ||
"unique_columns": [ | ||
"col_for_association" | ||
] | ||
} | ||
], | ||
"column_definitions": [ | ||
{ | ||
"name": "id", | ||
"nullok": false, | ||
"type": { | ||
"typename": "text" | ||
} | ||
}, | ||
{ | ||
"name": "col_for_association", | ||
"type": { | ||
"typename": "text" | ||
} | ||
} | ||
], | ||
"annotations": { | ||
"tag:isrd.isi.edu,2016:table-display": { | ||
"entry": { | ||
"selector_ux_mode": "simple-search-dropdown" | ||
}, | ||
"row_name": { | ||
"row_markdown_pattern": "{{{col_for_association}}}" | ||
} | ||
}, | ||
"tag:isrd.isi.edu,2016:visible-columns": { | ||
"compact": [ | ||
"id", "col_for_association" | ||
] | ||
} | ||
} | ||
} | ||
} | ||
} |