diff --git a/.idea/.gitignore b/.idea/.gitignore
new file mode 100644
index 0000000..26d3352
--- /dev/null
+++ b/.idea/.gitignore
@@ -0,0 +1,3 @@
+# Default ignored files
+/shelf/
+/workspace.xml
diff --git a/.idea/inspectionProfiles/Project_Default.xml b/.idea/inspectionProfiles/Project_Default.xml
new file mode 100644
index 0000000..0961fd1
--- /dev/null
+++ b/.idea/inspectionProfiles/Project_Default.xml
@@ -0,0 +1,29 @@
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/inspectionProfiles/profiles_settings.xml b/.idea/inspectionProfiles/profiles_settings.xml
new file mode 100644
index 0000000..105ce2d
--- /dev/null
+++ b/.idea/inspectionProfiles/profiles_settings.xml
@@ -0,0 +1,6 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/misc.xml b/.idea/misc.xml
new file mode 100644
index 0000000..3c29c38
--- /dev/null
+++ b/.idea/misc.xml
@@ -0,0 +1,4 @@
+
+
+
+
\ No newline at end of file
diff --git a/.idea/modules.xml b/.idea/modules.xml
new file mode 100644
index 0000000..cb0389d
--- /dev/null
+++ b/.idea/modules.xml
@@ -0,0 +1,8 @@
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/planetmint.iml b/.idea/planetmint.iml
new file mode 100644
index 0000000..acb3bb6
--- /dev/null
+++ b/.idea/planetmint.iml
@@ -0,0 +1,15 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/vcs.xml b/.idea/vcs.xml
new file mode 100644
index 0000000..94a25f7
--- /dev/null
+++ b/.idea/vcs.xml
@@ -0,0 +1,6 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/planetmint/backend/tarantool/database.py b/planetmint/backend/tarantool/database.py
index 0cf9c9d..8eb30e2 100644
--- a/planetmint/backend/tarantool/database.py
+++ b/planetmint/backend/tarantool/database.py
@@ -13,11 +13,22 @@ class TarantoolDB:
def init_tarantool():
- path = os.getcwd()
- run(["mkdir" , "tarantool"])
- run(["ln","-s",path +"/init.lua","init.lua"] , path+"/tarantool")
- run (["tarantool" , "init.lua"] ,path+ "/tarantool")
+ if os.path.exists(os.path.join(os.getcwd(), 'tarantool', 'init.lua')) is not True:
+ path = os.getcwd()
+ run(["mkdir" , "tarantool_snap"])
+ run(["ln","-s",path +"/init.lua","init.lua"] , path+"/tarantool_snap")
+ run (["tarantool" , "init.lua"] ,path+ "/tarantool")
+ else:
+ raise Exception("There is a instance of tarantool already created in %s" + os.getcwd() + "/tarantool_snap")
+
+
+
+
def drop_tarantool():
- #TODO drop tarantool
- pass
\ No newline at end of file
+ if os.path.exists(os.path.join(os.getcwd(), 'tarantool', 'init.lua')) is not True:
+ path = os.getcwd()
+ run(["ln","-s",path +"/drop_db.lua","drop_db.lua"] , path+"/tarantool_snap")
+ run (["tarantool" , "drop_db.lua"])
+ else:
+ raise Exception("There is no tarantool spaces to drop")
diff --git a/planetmint/backend/tarantool/drop_db.lua b/planetmint/backend/tarantool/drop_db.lua
new file mode 100644
index 0000000..aca9792
--- /dev/null
+++ b/planetmint/backend/tarantool/drop_db.lua
@@ -0,0 +1,5 @@
+box.space.transactions.drop()
+box.space.output.drop()
+box.space.inputs.drop()
+box.space.keys.drop()
+box.snapshot()
\ No newline at end of file
diff --git a/planetmint/commands/planetmint.py b/planetmint/commands/planetmint.py
index e134adb..7db13a6 100644
--- a/planetmint/commands/planetmint.py
+++ b/planetmint/commands/planetmint.py
@@ -13,7 +13,7 @@ import argparse
import copy
import json
import sys
-from planetmint.backend.tarantool.database import TarantoolDB, init_tarantool
+from planetmint.backend.tarantool.database import TarantoolDB, drop_tarantool, init_tarantool
from planetmint.core import rollback
from planetmint.migrations.chain_migration_election import ChainMigrationElection
@@ -259,18 +259,14 @@ def run_init(args):
@configure_planetmint
def run_drop(args):
"""Drop the database"""
- dbname = planetmint.config['database']['name']
if not args.yes:
- response = input_on_stderr('Do you want to drop `{}` database? [y/n]: '.format(dbname))
+ response = input_on_stderr('Do you want to drop `{}` database? [y/n]: ')
if response != 'y':
return
- conn = backend.connect()
- try:
- schema.drop_database(conn, dbname)
- except DatabaseDoesNotExist:
- print("Cannot drop '{name}'. The database does not exist.".format(name=dbname), file=sys.stderr)
+ drop_tarantool()
+
def run_recover(b):