/
PostgreSQL 모든 테이블 삭제(Drop Table)
PostgreSQL 모든 테이블 삭제(Drop Table)
Laravel migration 중 schema 이름이 변경되었을 경우 artisan migrate 명령어가 동작하지 않는다.
이런 경우 스키마내 모든 테이블을 삭제하면 됨.
먼저 psql 로 해당 스키마 연결
psql -U user -d dbname
DO $$ DECLARE r RECORD; BEGIN -- if the schema you operate on is not "current", you will want to -- replace current_schema() in query with 'schematodeletetablesfrom' -- *and* update the generate 'DROP...' accordingly. FOR r IN (SELECT tablename FROM pg_tables WHERE schemaname = current_schema()) LOOP EXECUTE 'DROP TABLE IF EXISTS ' || quote_ident(r.tablename) || ' CASCADE'; END LOOP; END $$;
Ref
같이 보기
, multiple selections available,
Related content
laravel column 변경 database migration 만들기
laravel column 변경 database migration 만들기
More like this
Laravel 의 BluePrint 를 수정해서 Oracle 의 NVARCHAR 2 사용하기
Laravel 의 BluePrint 를 수정해서 Oracle 의 NVARCHAR 2 사용하기
More like this
powershell 을 command line 에서 실행할 때 "'<' 연산자는 나중에 사용하도록 예약되어 있습니다". 에러
powershell 을 command line 에서 실행할 때 "'<' 연산자는 나중에 사용하도록 예약되어 있습니다". 에러
More like this
command line 에서 빈 sqlite 데이터베이스 파일 만들기
command line 에서 빈 sqlite 데이터베이스 파일 만들기
More like this
현재 Schema 로부터 ERD 만들기
현재 Schema 로부터 ERD 만들기
More like this
MySQL 테이블 삭제하기(Table drop)
MySQL 테이블 삭제하기(Table drop)
More like this