(model, connection=None)
| 522 | |
| 523 | |
| 524 | def _drop_table(model, connection=None): |
| 525 | if not _allow_schema_modification(): |
| 526 | return |
| 527 | |
| 528 | connection = connection or model._get_connection() |
| 529 | |
| 530 | # don't try to delete non existent tables |
| 531 | meta = get_cluster(connection).metadata |
| 532 | |
| 533 | ks_name = model._get_keyspace() |
| 534 | raw_cf_name = model._raw_column_family_name() |
| 535 | |
| 536 | try: |
| 537 | meta.keyspaces[ks_name].tables[raw_cf_name] |
| 538 | execute('DROP TABLE {0};'.format(model.column_family_name()), connection=connection) |
| 539 | except KeyError: |
| 540 | pass |
| 541 | |
| 542 | |
| 543 | def _allow_schema_modification(): |
no test coverage detected