Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Pedot Nicola
semint-kprime
Commits
24decfb2
Commit
24decfb2
authored
Jan 13, 2021
by
npedot
Browse files
tiny cleanup
parent
2a5d7d4d
Changes
2
Hide whitespace changes
Inline
Side-by-side
src/main/kotlin/unibz.cs.semint.kprime/domain/ddl/schemalgo/oids.kt
View file @
24decfb2
...
...
@@ -12,12 +12,12 @@ fun oid(schema: Schema, originTableName: String): List<String> {
// create a key-table with projection of oid and pk
val
keyCols
=
originTableKey
.
map
{
c
->
c
.
name
}.
joinToString
(
","
)
sqlCommands
.
add
(
"CREATE TABLE SKEY$originTableName AS SELECT sid,$keyCols FROM $originTableName"
)
sqlCommands
.
add
(
"ALTER TABLE $originTableName DROP COLUMN $keyCols"
)
// search ftables with foreign keys od double-inc as pk
// for each ftable adds one column oid with join with corresponding to fkey values
// replace pk origin-table
// replace fks to new surrogate id column
// remove ex-pk columns from origin-table
sqlCommands
.
add
(
"ALTER TABLE $originTableName DROP COLUMN $keyCols"
)
// remove ex-pk columns from fk tables
return
sqlCommands
}
\ No newline at end of file
src/test/kotlin/unibz.cs.semint.kprime/domain/SchemaTest.kt
View file @
24decfb2
...
...
@@ -78,7 +78,6 @@ class SchemaTest {
assertTrue
(
equivalent
(
setA
,
setB
))
}
@Test
fun
test_powerset
()
{
// given
...
...
@@ -300,7 +299,6 @@ class SchemaTest {
}
@Test
fun
test_deomposeTo3NF
()
{
// given
...
...
@@ -410,7 +408,6 @@ class SchemaTest {
}
@Test
fun
test_lostBCNFConstraints
()
{
// given
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment