Browse Source

added migration for users

php2python
Holger Frey 7 years ago
parent
commit
da4db69146
  1. 4792
      ordr2/scripts/export_consumables.yml
  2. 97398
      ordr2/scripts/export_orders.yml
  3. 715
      ordr2/scripts/export_users.yml
  4. 45
      ordr2/scripts/initializedb.py

4792
ordr2/scripts/export_consumables.yml

File diff suppressed because it is too large Load Diff

97398
ordr2/scripts/export_orders.yml

File diff suppressed because it is too large Load Diff

715
ordr2/scripts/export_users.yml

@ -0,0 +1,715 @@
%YAML 1.1
---
# imtekordr.users
-
id: 99
username: "MartinSchoenstein"
first_name: "Martin"
last_name: "Schoenstein"
password: "ea8458396a0c17954f9a9bc5b835f81148a39bcb"
email: "schoenst@imtek.de"
role: "Purchaser"
date_created: "2012-04-05 14:29:21"
-
id: 98
username: "DanielaMoessner"
first_name: "Daniela"
last_name: "Moessner"
password: "5ee566ad84396a2a26d7f6fcdf589a261f202569"
email: "moessner@imtek.de"
role: "Purchaser"
date_created: "2012-03-30 09:35:40"
-
id: 97
username: "AlexanderDietz"
first_name: "Alexander"
last_name: "Dietz"
password: "621d0004efe268724a86473649ae3ced2871e1c9"
email: "alexander.dietz@imtek.uni-freiburg.de"
role: "Purchaser"
date_created: "2012-03-29 16:39:29"
-
id: 94
username: "ASasdasdgase"
first_name: "ASasd"
last_name: "asdgase"
password: "7c4a8d09ca3762af61e59520943dc26494f8941b"
email: "axsd@sdasd.com"
role: "Inactive"
date_created: "2012-02-15 15:27:34"
-
id: 82
username: "SebastianSebald"
first_name: "Sebastian"
last_name: "Sebald"
password: "9b3e1fa230b050fb324086e2fcc94b1b9aa2ac35"
email: "sebastian.sebald@gmail.com"
role: "Admin"
date_created: "2012-01-20 13:12:53"
-
id: 89
username: "HolgerFrey"
first_name: "Holger"
last_name: "Frey"
password: "holgi"
email: "frey@imtek.de"
role: "Admin"
date_created: "2012-01-20 21:35:40"
-
id: 100
username: "MaxMustermann"
first_name: "Max"
last_name: "Mustermann"
password: "af0ba23d48fe7db684d9a9d13eb5ec0f5183081c"
email: "oswaldprucker@web.de"
role: "Inactive"
date_created: "2012-05-16 08:40:37"
-
id: 91
username: "NataliaSchatz"
first_name: "Natalia"
last_name: "Schatz"
password: "5f89fc9b6033aa210658489a14bf865a096dd702"
email: "schatz@imtek.de"
role: "Admin"
date_created: "2012-01-20 21:37:32"
-
id: 92
username: "OswaldPrucker"
first_name: "Oswald"
last_name: "Prucker"
password: "4aa75e8bc73f4bc072133a10acb728633d83eb20"
email: "prucker@imtek.de"
role: "Admin"
date_created: "2012-01-20 22:22:27"
-
id: 96
username: "MalwinaPajestka"
first_name: "Malwina"
last_name: "Pajestka"
password: "cf8abbfad4ea9a10200e6b0b6008ac55dcbc499e"
email: "malwina.pajestka@imtek.de"
role: "Purchaser"
date_created: "2012-03-29 14:47:44"
-
id: 155
username: "AlexandraSchneider"
first_name: "Alexandra"
last_name: "Schneider"
password: "f3d4facdde3f40ad5abaf8b8bb17f2da7b08af32"
email: "alexandra.schneider@jupiter.uni-freiburg"
role: "User"
date_created: "2015-08-04 16:45:44"
-
id: 102
username: "MichaelHenze"
first_name: "Michael"
last_name: "Henze"
password: "2dfa7ae9d549ae3e152c1621b111d92029972749"
email: "michael.henze@imtek.uni-freiburg.de"
role: "User"
date_created: "2012-05-22 17:00:41"
-
id: 154
username: "VaniaWidyaya"
first_name: "Vania"
last_name: "Widyaya"
password: "93b8e920dce9eb632b4698a77ca63a1dd6f3d14c"
email: "vania.widyaya@imtek.uni-freiburg.de"
role: "User"
date_created: "2015-05-06 09:47:09"
-
id: 104
username: "RomanErath"
first_name: "Roman"
last_name: "Erath"
password: "452f3991d26d97c62cdf6bbcb31ef2be9b42df1d"
email: "roman.erath@imtek.uni-freiburg.de"
role: "User"
date_created: "2012-05-29 13:42:51"
-
id: 106
username: "WibkeHartleb"
first_name: "Wibke"
last_name: "Hartleb"
password: "aeea4f54de35d5abe4d0fcbb8116df4842bc7304"
email: "hartleb@imtek.de"
role: "Inactive"
date_created: "2012-06-04 16:19:55"
-
id: 107
username: "FranziskaDorner"
first_name: "Franziska"
last_name: "Dorner"
password: "0320f2762d397cb4225f36bcad23a1d6ec9a5dd5"
email: "franziska.dorner@imtek.de"
role: "Inactive"
date_created: "2012-06-04 16:28:24"
-
id: 156
username: "ChinnawutPipatpanukul"
first_name: "Chinnawut"
last_name: "Pipatpanukul"
password: "fc0b55c7a97cb2b16d94844dd3b260435cb69acd"
email: "polymer_chin@hotmail.com"
role: "User"
date_created: "2015-09-07 17:03:11"
-
id: 110
username: "SimonSchuster"
first_name: "Simon"
last_name: "Schuster"
password: "5cd79755dcc701a0a72bbeacd5a45aa932c3d63f"
email: "schuster@imtek.uni-freiburg.de"
role: "Inactive"
date_created: "2012-06-18 15:27:14"
-
id: 111
username: "JonGreen"
first_name: "Jon"
last_name: "Green"
password: "871f35fb0bc758f97dcc9dc484b9002014322c1b"
email: "jon.green@imtek.uni-freiburg.de"
role: "Inactive"
date_created: "2012-06-27 15:30:31"
-
id: 113
username: "PengZou"
first_name: "Peng"
last_name: "Zou"
password: "50d1199385e3b7c39d382017e281e37782d84026"
email: "peng.zou@imtek.uni-freiburg.de"
role: "User"
date_created: "2012-07-30 10:38:40"
-
id: 114
username: "HolgerKlapproth"
first_name: "Holger"
last_name: "Klapproth"
password: "ec2ec7fad8702059c81783d7cb720d288ffb6786"
email: "holger.klapproth@imtek.de"
role: "User"
date_created: "2012-07-31 12:39:58"
-
id: 115
username: "TobiasHeitzler"
first_name: "Tobias"
last_name: "Heitzler"
password: "1d119fcf4eb869e99de044125cbe54960e84b1de"
email: "tobias.heitzler@jupiter.uni-freiburg.de"
role: "Inactive"
date_created: "2012-08-20 10:27:36"
-
id: 116
username: "VitaliyKondrashov"
first_name: "Vitaliy"
last_name: "Kondrashov"
password: "a194f7e6584fd78fc6fd87aea8244d7d28cecdfb"
email: "vitaliy.kondrashov@imtek.de"
role: "Inactive"
date_created: "2012-09-12 12:37:03"
-
id: 117
username: "MaraFlorea"
first_name: "Mara"
last_name: "Florea"
password: "2c7d26e5a650f1452596c5d6859f1de70e9dfda0"
email: "mara.florea@fmf-uni-freiburg.de"
role: "User"
date_created: "2012-09-24 09:57:37"
-
id: 118
username: "NicoleBirsner"
first_name: "Nicole"
last_name: "Birsner"
password: "205e21a7eb6a9475d252cc34ec5652a48cd40a1b"
email: "birsner@imtek.de"
role: "User"
date_created: "2012-09-26 16:11:50"
-
id: 119
username: "KarenLienkamp"
first_name: "Karen"
last_name: "Lienkamp"
password: "810616773a6895260bb6b1f06436bf5919b9ac7e"
email: "lienkamp@imtek.uni-freiburg.de"
role: "Purchaser"
date_created: "2012-10-17 13:38:47"
-
id: 120
username: "ChristophScheibelein"
first_name: "Christoph"
last_name: "Scheibelein"
password: "d52b154b64b76cb7d41c900b6dc04075568f5881"
email: "christoph.scheibelein@imtek.de"
role: "User"
date_created: "2012-10-30 17:00:57"
-
id: 151
username: "CrispinAmiriNaini"
first_name: "Crispin"
last_name: "AmiriNaini"
password: "a5e0427ef5e4b47165950f2233767158c6305d72"
email: "crispin.amiri@imtek.de"
role: "User"
date_created: "2015-01-16 15:17:00"
-
id: 121
username: "DavidBoschert"
first_name: "David"
last_name: "Boschert"
password: "219ca82924d6388be4be803104e721c28c7bd8ed"
email: "david.boschert@frias.uni-freiburg.de"
role: "User"
date_created: "2013-01-22 12:01:21"
-
id: 122
username: "NilsKorf"
first_name: "Nils"
last_name: "Korf"
password: "2785030b6e08e0c1b5ff80080382efbe11efd644"
email: "nils.korf@bcf.uni-freiburg.de"
role: "Inactive"
date_created: "2013-01-29 13:26:11"
-
id: 123
username: "FrankScherag"
first_name: "Frank"
last_name: "Scherag"
password: "acd383d906d92779723d121ac3399aa0d84dde00"
email: "Frank.Scherag@imtek.uni-freiburg.de"
role: "User"
date_created: "2013-03-07 10:49:57"
-
id: 124
username: "AnnaSchuler"
first_name: "Anna"
last_name: "Schuler"
password: "e546a402c7ee629029bad23803b14768207fd61a"
email: "anne-katrin.schuler@imtek.uni-freiburg.d"
role: "User"
date_created: "2013-03-12 13:07:07"
-
id: 157
username: "SebastianAnders"
first_name: "Sebastian"
last_name: "Anders"
password: "3d48159e1c5a08a06aa8149208791f686effaba6"
email: "sebastian.anders@imtek.de"
role: "User"
date_created: "2015-09-24 10:34:21"
-
id: 126
username: "MarcelRothfelder"
first_name: "Marcel"
last_name: "Rothfelder"
password: "cb70c818d0a3ab0d595fabbe7eadcf96d7e003f9"
email: "marcel.rothfelder@fmf.uni-freiburg.de"
role: "User"
date_created: "2013-03-28 09:42:44"
-
id: 127
username: "AnneBuderer"
first_name: "Anne"
last_name: "Buderer"
password: "574f939d78617aef36d6240e3cd5c90eb390aa73"
email: "anne.buderer@imtek.uni-freiburg.de"
role: "User"
date_created: "2013-04-02 10:20:27"
-
id: 153
username: "SureshBanda"
first_name: "Suresh"
last_name: "Banda"
password: "91b33a824a0aaac74bfd465ab0ad253885896b20"
email: "suresh.banda@imtek.de"
role: "User"
date_created: "2015-02-19 14:43:41"
-
id: 152
username: "RolandHoenes"
first_name: "Roland"
last_name: "Hoenes"
password: "ad972ff6f6c8e9c1b9fd44a1b9774877482d0974"
email: "roland.hoenes@imtek.de"
role: "User"
date_created: "2015-02-03 09:42:28"
-
id: 129
username: "AnselmHoppmann"
first_name: "Anselm"
last_name: "Hoppmann"
password: "98fe5b48a33f8618fe08f9ca4b8dfb3256fa7e00"
email: "anselm.hoppmann@gmx.de"
role: "Inactive"
date_created: "2013-06-04 10:27:08"
-
id: 130
username: "ShararehAsiaee"
first_name: "Sharareh"
last_name: "Asiaee"
password: "d01d59fb35a1fbbba731f81f28fb43baf3eeb5e5"
email: "sharareh.sahneh@imtek.de"
role: "User"
date_created: "2013-07-04 11:58:37"
-
id: 132
username: "MarcZinggeler"
first_name: "Marc"
last_name: "Zinggeler"
password: "2aead214ed9af75a0dbd8a9c50341ba2a5945451"
email: "marc.zinggeler@imtek.uni-freiburg.de"
role: "User"
date_created: "2013-07-05 12:23:34"
-
id: 133
username: "XiaoqiangHou"
first_name: "Xiaoqiang"
last_name: "Hou"
password: "f717b7dc2f620d074151d544bec5328481d7faac"
email: "xiaoqiang.hou@imtek.de"
role: "User"
date_created: "2013-07-05 16:44:39"
-
id: 134
username: "SamarKazan"
first_name: "Samar"
last_name: "Kazan"
password: "334ef431feb818a657a5d413c341bce0d28cd407"
email: "samar.kazan@imtek.uni-freiburg.de"
role: "User"
date_created: "2013-07-10 14:30:57"
-
id: 136
username: "SaschaEngel"
first_name: "Sascha"
last_name: "Engel"
password: "94299c5dc1b3e954f0d7500d2bc3770a66bbd325"
email: "sascha.engel@imtek.uni-freiburg.de"
role: "Inactive"
date_created: "2013-08-09 13:47:01"
-
id: 137
username: "MartinKoerner"
first_name: "Martin"
last_name: "Koerner"
password: "115e67def35ce67ede63c93d7d81479d828d705c"
email: "martin.koerner@imtek.de"
role: "User"
date_created: "2013-08-26 15:02:45"
-
id: 138
username: "UrmilShah"
first_name: "Urmil"
last_name: "Shah"
password: "27bf49a7ec0d428a4e65ac5fbe88bd0bd8d55643"
email: "shahurmil86@yahoo.com"
role: "User"
date_created: "2013-10-29 14:28:59"
-
id: 139
username: "DavidSchwaerzle"
first_name: "David"
last_name: "Schwaerzle"
password: "938791e4907d0673c3baf5278b574f11b45c2fbb"
email: "david.schwaerzle@gmx.de"
role: "User"
date_created: "2013-10-29 14:29:02"
-
id: 147
username: "MonikaKurowska"
first_name: "Monika"
last_name: "Kurowska"
password: "a5fcbf21e6919599279dbe9c4adfea9878686321"
email: "monikkurowska@gmail.com"
role: "User"
date_created: "2014-10-02 09:21:18"
-
id: 140
username: "PhilipKotrade"
first_name: "Philip"
last_name: "Kotrade"
password: "8200057b2e20c4e5b801336841e6849de8bf3716"
email: "Philip.Kotrade@imtek.uni-freiburg.de"
role: "User"
date_created: "2013-11-07 11:19:22"
-
id: 141
username: "NiklasSchoenberg"
first_name: "Niklas"
last_name: "Schoenberg"
password: "6a2bf1397988b6da3c2857c2466a2396365880a0"
email: "schoenberg@imtek.de"
role: "User"
date_created: "2013-11-07 15:35:13"
-
id: 142
username: "MatthiasMenzel"
first_name: "Matthias"
last_name: "Menzel"
password: "8b1a8e1c534016c16396dc2308dbb9410221df20"
email: "matthias.menzel@imtek.uni-freiburg.de"
role: "User"
date_created: "2013-12-10 12:40:26"
-
id: 144
username: "MostafaMahmoud"
first_name: "Mostafa"
last_name: "Mahmoud"
password: "1dc1feb8629b3292065654e2a50160177b6e5aab"
email: "mostafasafwat@live.com"
role: "Inactive"
date_created: "2014-02-28 15:49:50"
-
id: 145
username: "HeidiPerez"
first_name: "Heidi"
last_name: "Perez"
password: "b3223810838aee0d0d08bef11ae6ab8139ead98d"
email: "heidi.perez@frias.uni-freiburg.de"
role: "Inactive"
date_created: "2014-04-23 13:32:24"
-
id: 146
username: "EstherRiga"
first_name: "Esther"
last_name: "Riga"
password: "f58b22fe282c539d9504e4f5023f30a5e694dae4"
email: "esther.riga@imtek.uni-freiburg.de"
role: "User"
date_created: "2014-07-08 13:34:35"
-
id: 148
username: "thomasseery"
first_name: "thomas"
last_name: "seery"
password: "808b3bf707af545878b2a14fe8d29649f6d5c227"
email: "seery@mail.ims.uconn.edu"
role: "Inactive"
date_created: "2014-10-16 16:24:24"
-
id: 149
username: "VanessaWeiss"
first_name: "Vanessa"
last_name: "Weiss"
password: "cdab1dc399f2db48b9f0d7edf241ffd5163ccf97"
email: "vanessa.weiss@imtek.de"
role: "User"
date_created: "2014-11-21 13:47:35"
-
id: 150
username: "AndreasMader"
first_name: "Andreas"
last_name: "Mader"
password: "ef18eaebcdc6ec5cc07f1d60f07ff0056ff6fc9d"
email: "andreas.mader@imtek.de"
role: "Inactive"
date_created: "2014-12-02 15:34:58"
-
id: 158
username: "JuliaSaar"
first_name: "Julia"
last_name: "Saar"
password: "c931d353713d309431819e824d6b8d5ffcc91660"
email: "Julia.Saar91@googlemail.com"
role: "User"
date_created: "2015-10-26 09:35:14"
-
id: 159
username: "MariaVoehringer"
first_name: "Maria"
last_name: "Voehringer"
password: "4538f730a9e9ad282753a447376a7bb4537ab24c"
email: "maria.voehringer@gmx.de"
role: "User"
date_created: "2015-11-23 11:00:08"
-
id: 160
username: "JessicaBean"
first_name: "Jessica"
last_name: "Bean"
password: "61095da8cef256650a98ad2941ba71892f15c958"
email: "jessica.bean@fmf.uni-freiburg.de"
role: "User"
date_created: "2015-11-24 15:22:32"
-
id: 161
username: "SimonZunker"
first_name: "Simon"
last_name: "Zunker"
password: "f19814fbf8f2cbdfee3fff746553869c30d3828b"
email: "simon.zunker@imtek.uni-freiburg.de"
role: "User"
date_created: "2016-01-26 16:42:14"
-
id: 162
username: "WeiChen"
first_name: "Wei"
last_name: "Chen"
password: "cb0aed09cd8838e6a4a319d284315ff51069ad75"
email: "wei.chen@imtek.uni-freiburg.de"
role: "User"
date_created: "2016-01-27 09:53:00"
-
id: 163
username: "AndreasWalder"
first_name: "Andreas"
last_name: "Walder"
password: "19dc4b581986466ef062d3e9d4eb2ae862e88a39"
email: "andreas.walder@imtek.uni-freiburg.de"
role: "User"
date_created: "2016-02-12 14:47:11"
-
id: 164
username: "KrisdaSudprasert"
first_name: "Krisda"
last_name: "Sudprasert"
password: "8520af56684c336d8403d0436b59010ea427a602"
email: "srati_wonnuch@hotmail.com"
role: "Inactive"
date_created: "2016-03-02 14:26:40"
-
id: 165
username: "ThananthornKanokwijitsilp"
first_name: "Thananthorn"
last_name: "Kanokwijitsilp"
password: "bf7b831ec66bdba869dbed4bbf203661ab5a2a6e"
email: "kanokwijitsilp@imtek.de"
role: "User"
date_created: "2016-03-09 10:23:26"
-
id: 166
username: "AlexanderStraub"
first_name: "Alexander"
last_name: "Straub"
password: "0cabd9350fe909cedb21776957fcf72f00a3210e"
email: "alexander.straub@jupiter.uni-freiburg.de"
role: "User"
date_created: "2016-05-25 09:48:39"
-
id: 167
username: "TaisukeKojima"
first_name: "Taisuke"
last_name: "Kojima"
password: "da53b8d3a7cbee5aaa7985a6330d8e83206aba5e"
email: "taisuke.kojima@imtek.uni-freiburg.de"
role: "User"
date_created: "2016-06-03 13:09:43"
-
id: 168
username: "StefanMuellers"
first_name: "Stefan"
last_name: "Muellers"
password: "653a9b2a076040f8246a5143901b0c1628176b27"
email: "stefan.muellers@imtek.uni-freiburg.de"
role: "User"
date_created: "2016-06-20 09:00:46"
-
id: 169
username: "JonasKost"
first_name: "Jonas"
last_name: "Kost"
password: "7bfa62293f70e1d6ee017642223cdbf7ae227f2d"
email: "jonas.kost@imtek.uni-freiburg.de"
role: "User"
date_created: "2016-07-11 09:57:57"
-
id: 170
username: "SimonSchoelch"
first_name: "Simon"
last_name: "Schoelch"
password: "fb747c7e015579361c416d4a59fbffe11a21be2f"
email: "simon.schoelch@gmail.com"
role: "User"
date_created: "2016-07-11 14:44:54"
-
id: 171
username: "ZhuolingDeng"
first_name: "Zhuoling"
last_name: "Deng"
password: "9374fdfaf8bc080b30233819f7f59bdb97b7a292"
email: "zhuoling.deng@merkur.uni-freiburg.de"
role: "User"
date_created: "2016-08-03 10:33:55"
-
id: 172
username: "TaoZou"
first_name: "Tao"
last_name: "Zou"
password: "0982e0a944c95b1b8d479e9635a4d05c656dd2e1"
email: "zout1219@msn.cn"
role: "User"
date_created: "2016-08-11 10:49:50"
-
id: 173
username: "StefanBritz"
first_name: "Stefan"
last_name: "Britz"
password: "c0836a94f6b666febedda96600fc8bec2999e086"
email: "stefan.britz@imtek.uni-freiburg.de"
role: "User"
date_created: "2016-11-02 13:18:23"
-
id: 174
username: "AliceEickenscheidt"
first_name: "Alice"
last_name: "Eickenscheidt"
password: "eb1db0df34b947382e2edeab0300f34f660f2fc9"
email: "alice.eickenscheidt@imtek.uni-freiburg.d"
role: "User"
date_created: "2016-11-03 13:18:08"
-
id: 175
username: "SarahFontaine"
first_name: "Sarah"
last_name: "Fontaine"
password: "5ace8b390b394d6438d4f691f06613996f61f919"
email: "sarah.fontaine@uranus.uni-freiburg.de"
role: "User"
date_created: "2016-11-09 13:24:59"
-
id: 176
username: "BidhariPidhatika"
first_name: "Bidhari"
last_name: "Pidhatika"
password: "9a68eb1ffa40cf74e8498d5641d16de456ac37ad"
email: "bpidhatika@gmail.com"
role: "User"
date_created: "2016-12-06 10:18:04"
-
id: 177
username: "LukasMetzler"
first_name: "Lukas"
last_name: "Metzler"
password: "0778b41d0d82cda54ba3f7176c566272cac16f88"
email: "lukas.metzler@imtek.de"
role: "User"
date_created: "2016-12-22 14:19:15"
-
id: 179
username: "KatrinTuecking"
first_name: "Katrin"
last_name: "Tuecking"
password: "9fb28ff3449a1436cd964aef6d5aa695ddcc1636"
email: "katrintuecking@web.de"
role: "User"
date_created: "2017-02-07 15:01:30"
-
id: 180
username: "CarmenEger"
first_name: "Carmen"
last_name: "Eger"
password: "f3bbfcf8a5f5430d020afdaae6e8f2745366bd0e"
email: "carmen.eger@pluto.uni-freiburg.de"
role: "User"
date_created: "2017-02-20 10:32:28"
-
id: 181
username: "DeepaPantulu"
first_name: "Deepa"
last_name: "Pantulu"
password: "641c92fce59bfa5ad4d80c47d0f932f853ced64c"
email: "deepa.pantulu@imtek.uni-freiburg.de"
role: "User"
date_created: "2017-04-06 10:22:54"
...

45
ordr2/scripts/initializedb.py

@ -1,6 +1,11 @@
import os import os
import sys import sys
import transaction import transaction
import yaml
from datetime import datetime
from tqdm import tqdm
from urllib.parse import urlparse from urllib.parse import urlparse
from pyramid.paster import ( from pyramid.paster import (
@ -26,6 +31,19 @@ def usage(argv):
sys.exit(1) sys.exit(1)
def read_exported_file(*paths):
path = os.path.join(*paths)
with open(path, 'r') as filehandle:
items = yaml.load(filehandle)
return items
def parse_dt(value, default=None):
if value.startswith('0000'):
return default or datetime.utcnow()
return datetime.strptime(value + ' -0000', '%Y-%m-%d %H:%M:%S %z')
def main(argv=sys.argv): def main(argv=sys.argv):
if len(argv) < 2: if len(argv) < 2:
usage(argv) usage(argv)
@ -37,7 +55,7 @@ def main(argv=sys.argv):
# remove an existing sqlite database to issue a restart # remove an existing sqlite database to issue a restart
database_url = urlparse(settings['sqlalchemy.url']) database_url = urlparse(settings['sqlalchemy.url'])
if database_url.scheme == 'sqlite' and os.path.isfile(database_url.path): if database_url.scheme == 'sqlite' and os.path.isfile(database_url.path):
os.remove(path) os.remove(database_url.path)
engine = get_engine(settings) engine = get_engine(settings)
Base.metadata.create_all(engine) Base.metadata.create_all(engine)
@ -47,12 +65,21 @@ def main(argv=sys.argv):
with transaction.manager: with transaction.manager:
dbsession = get_tm_session(session_factory, transaction.manager) dbsession = get_tm_session(session_factory, transaction.manager)
model = User( base_dir = os.path.dirname(__file__)
user_name='HolgerFrey', user_list = read_exported_file(base_dir, 'export_users.yml')
first_name='Holger', for data in tqdm(user_list, desc='Users'):
last_name='Frey', user = User(
email='frey@imtek.de', id=data['id'],
role=Role.ADMIN user_name=data['username'],
first_name=data['first_name'],
last_name=data['last_name'],
email=data['email'],
role=Role(data['role'].lower())
) )
model.set_password('holgi') if user.user_name == 'HolgerFrey':
dbsession.add(model) user.set_password('holgi')
else:
user.set_password(data['password'])
dbsession.add(user)
dbsession.flush()