Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
pony
tshistory_supervision
Commits
bf0fdfff7fdd
Commit
9e2e2232
authored
Jun 12, 2019
by
Aurélien Campéas
Browse files
schema: rename `tsh-automatic` to `tsh-upstream`
parent
b6c993936bc2
Changes
4
Show whitespace changes
Inline
Side-by-side
conftest.py
View file @
bf0fdfff
...
...
@@ -19,7 +19,7 @@ def engine(request):
db
.
setup_local_pg_cluster
(
request
,
DATADIR
,
port
)
uri
=
'postgresql://localhost:{}/postgres'
.
format
(
port
)
sch1
=
tsschema
()
sch2
=
tsschema
(
'tsh-
automatic
'
)
sch2
=
tsschema
(
'tsh-
upstream
'
)
e
=
create_engine
(
uri
)
sch1
.
create
(
e
)
sch2
.
create
(
e
)
...
...
setup.py
View file @
bf0fdfff
...
...
@@ -12,6 +12,9 @@ setup(name='tshistory_supervision',
install_requires
=
[
'tshistory'
],
entry_points
=
{
'tshistory.subcommands'
:
[
'migrate-supervision=tshistory_supervision.cli:migrate_supervision'
]},
classifiers
=
[
'Development Status :: 4 - Beta'
,
'Intended Audience :: Developers'
,
...
...
tshistory_supervision/cli.py
0 → 100644
View file @
bf0fdfff
import
click
from
sqlalchemy
import
create_engine
from
tshistory.util
import
find_dburi
@
click
.
command
(
name
=
'migrate-supervision'
)
@
click
.
argument
(
'dburi'
)
@
click
.
option
(
'--namespace'
,
default
=
'tsh'
)
def
migrate_supervision
(
dburi
,
skip_schema
=
False
,
namespace
=
'tsh'
):
engine
=
create_engine
(
find_dburi
(
dburi
))
with
engine
.
begin
()
as
cn
:
cn
.
execute
(
f
'alter schema "
{
namespace
}
-automatic" '
f
'rename to "
{
namespace
}
-upstream"'
)
cn
.
execute
(
f
'alter schema "
{
namespace
}
-automatic.timeserie" '
f
'rename to "
{
namespace
}
-upstream.timeserie"'
)
cn
.
execute
(
f
'alter schema "
{
namespace
}
-automatic.snapshot" '
f
'rename to "
{
namespace
}
-upstream.snapshot"'
)
tshistory_supervision/tsio.py
View file @
bf0fdfff
...
...
@@ -55,7 +55,7 @@ class timeseries(basets):
def
__init__
(
self
,
*
a
,
**
kw
):
super
().
__init__
(
*
a
,
**
kw
)
self
.
upstream
=
basets
(
namespace
=
'{}-
automatic
'
.
format
(
self
.
namespace
))
self
.
upstream
=
basets
(
namespace
=
'{}-
upstream
'
.
format
(
self
.
namespace
))
@
tx
def
insert
(
self
,
cn
,
ts
,
name
,
author
,
...
...
Write
Preview
Markdown
is supported
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