Skip to content

Commit

Permalink
Merge pull request #522 from woowacourse-teams/dev
Browse files Browse the repository at this point in the history
hotfix: flyway ddl 수정
  • Loading branch information
lilychoibb authored Sep 25, 2024
2 parents 70b4123 + fb106c6 commit 4fbd084
Show file tree
Hide file tree
Showing 3 changed files with 46 additions and 41 deletions.
2 changes: 1 addition & 1 deletion backend/secrets
35 changes: 20 additions & 15 deletions backend/src/main/resources/db/migration/V1__init.sql
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
CREATE TABLE member (
CREATE TABLE IF NOT EXISTS member (
id BIGINT AUTO_INCREMENT,
email VARCHAR(255),
provider VARCHAR(255) NOT NULL CHECK (provider IN ('GITHUB')),
Expand All @@ -9,7 +9,7 @@ CREATE TABLE member (
CONSTRAINT pk_member PRIMARY KEY (id)
);

CREATE TABLE mission (
CREATE TABLE IF NOT EXISTS mission (
id BIGINT AUTO_INCREMENT,
title VARCHAR(255) NOT NULL,
thumbnail VARCHAR(255) NOT NULL,
Expand All @@ -18,7 +18,7 @@ CREATE TABLE mission (
CONSTRAINT pk_mission PRIMARY KEY (id)
);

CREATE TABLE discussion (
CREATE TABLE IF NOT EXISTS discussion (
id BIGINT AUTO_INCREMENT,
title VARCHAR(255),
content TEXT NOT NULL,
Expand All @@ -30,6 +30,11 @@ CREATE TABLE discussion (
CONSTRAINT fk_mission FOREIGN KEY (mission_id) REFERENCES mission(id)
);

ALTER TABLE discussion DROP FOREIGN KEY fk_member;
ALTER TABLE discussion DROP FOREIGN KEY fk_mission;
ALTER TABLE discussion ADD CONSTRAINT fk_discussion_member FOREIGN KEY (member_id) REFERENCES member(id);
ALTER TABLE discussion ADD CONSTRAINT fk_discussion_mission FOREIGN KEY (mission_id) REFERENCES mission(id);

CREATE TABLE discussion_comment (
id BIGINT AUTO_INCREMENT,
content TEXT NOT NULL,
Expand All @@ -39,9 +44,9 @@ CREATE TABLE discussion_comment (
deleted_at TIMESTAMP(6),
created_at TIMESTAMP(6) NOT NULL,
CONSTRAINT pk_discussion_comment PRIMARY KEY (id),
CONSTRAINT fk_discussion FOREIGN KEY (discussion_id) REFERENCES discussion(id),
CONSTRAINT fk_member FOREIGN KEY (member_id) REFERENCES member(id),
CONSTRAINT fk_discussion_comment FOREIGN KEY (parent_comment_id) REFERENCES discussion_comment(id)
CONSTRAINT fk_discussion_comment_discussion FOREIGN KEY (discussion_id) REFERENCES discussion(id),
CONSTRAINT fk_discussion_comment_member FOREIGN KEY (member_id) REFERENCES member(id),
CONSTRAINT fk_discussion_comment_discussion_comment FOREIGN KEY (parent_comment_id) REFERENCES discussion_comment(id)
);

CREATE TABLE hash_tag (
Expand All @@ -54,17 +59,17 @@ CREATE TABLE discussion_hash_tag (
discussion_id BIGINT NOT NULL,
hash_tag_id BIGINT NOT NULL,
CONSTRAINT pk_discussion_hash_tag PRIMARY KEY (discussion_id, hash_tag_id),
CONSTRAINT fk_discussion FOREIGN KEY (discussion_id) REFERENCES discussion(id),
CONSTRAINT fk_hash_tag FOREIGN KEY (hash_tag_id) REFERENCES hash_tag(id)
CONSTRAINT fk_discussion_hash_tag_discussion FOREIGN KEY (discussion_id) REFERENCES discussion(id),
CONSTRAINT fk_discussion_hash_tag_hash_tag FOREIGN KEY (hash_tag_id) REFERENCES hash_tag(id)
);

CREATE TABLE mission_hash_tag (
id BIGINT AUTO_INCREMENT,
mission_id BIGINT NOT NULL,
hash_tag_id BIGINT NOT NULL,
CONSTRAINT pk_mission_hash_tag PRIMARY KEY (id),
CONSTRAINT fk_hash_tag FOREIGN KEY (hash_tag_id) REFERENCES hash_tag(id),
CONSTRAINT fk_mission FOREIGN KEY (mission_id) REFERENCES mission(id)
CONSTRAINT fk_mission_hash_tag_hash_tag FOREIGN KEY (hash_tag_id) REFERENCES hash_tag(id),
CONSTRAINT fk_mission_hash_tag_mission FOREIGN KEY (mission_id) REFERENCES mission(id)
);

CREATE TABLE solution (
Expand All @@ -77,8 +82,8 @@ CREATE TABLE solution (
status VARCHAR(255) NOT NULL CHECK (status IN ('IN_PROGRESS','COMPLETED')),
created_at TIMESTAMP(6) NOT NULL,
CONSTRAINT pk_solution PRIMARY KEY (id),
CONSTRAINT fk_member FOREIGN KEY (member_id) REFERENCES member(id),
CONSTRAINT fk_mission FOREIGN KEY (mission_id) REFERENCES mission(id)
CONSTRAINT fk_solution_member FOREIGN KEY (member_id) REFERENCES member(id),
CONSTRAINT fk_solution_mission FOREIGN KEY (mission_id) REFERENCES mission(id)
);

CREATE TABLE solution_comment (
Expand All @@ -90,7 +95,7 @@ CREATE TABLE solution_comment (
deleted_at TIMESTAMP(6),
created_at TIMESTAMP(6) NOT NULL,
CONSTRAINT pk_solution_comment PRIMARY KEY (id),
CONSTRAINT fk_member FOREIGN KEY (member_id) REFERENCES member(id),
CONSTRAINT fk_solution_comment FOREIGN KEY (parent_comment_id) REFERENCES solution_comment(id),
CONSTRAINT fk_solution FOREIGN KEY (solution_id) REFERENCES solution(id)
CONSTRAINT fk_solution_comment_member FOREIGN KEY (member_id) REFERENCES member(id),
CONSTRAINT fk_solution_comment_solution_comment FOREIGN KEY (parent_comment_id) REFERENCES solution_comment(id),
CONSTRAINT fk_solution_comment_solution FOREIGN KEY (solution_id) REFERENCES solution(id)
);
50 changes: 25 additions & 25 deletions frontend/src/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -256,34 +256,34 @@ export const router = createBrowserRouter(routes, {
basename: ROUTES.main,
});

async function enableMocking() {
if (process.env.NODE_ENV !== 'development') {
return;
}
// async function enableMocking() {
// if (process.env.NODE_ENV !== 'development') {
// return;
// }

const { worker } = await import('./mocks/browser');
// const { worker } = await import('./mocks/browser');

// `worker.start()` returns a Promise that resolves
// once the Service Worker is up and ready to intercept requests.
return worker.start();
}
// // `worker.start()` returns a Promise that resolves
// // once the Service Worker is up and ready to intercept requests.
// return worker.start();
// }

enableMocking().then(() => {
root.render(
<React.StrictMode>
<QueryClientProvider client={queryClient}>
<QueryErrorBoundary>
<ErrorBoundary fallback={<div>에러에요!</div>}>
<ThemeProvider theme={theme}>
<GlobalStyle />
<RouterProvider router={router} />
</ThemeProvider>
</ErrorBoundary>
</QueryErrorBoundary>
</QueryClientProvider>
</React.StrictMode>,
);
});
// enableMocking().then(() => {
// root.render(
// <React.StrictMode>
// <QueryClientProvider client={queryClient}>
// <QueryErrorBoundary>
// <ErrorBoundary fallback={<div>에러에요!</div>}>
// <ThemeProvider theme={theme}>
// <GlobalStyle />
// <RouterProvider router={router} />
// </ThemeProvider>
// </ErrorBoundary>
// </QueryErrorBoundary>
// </QueryClientProvider>
// </React.StrictMode>,
// );
// });

root.render(
<React.StrictMode>
Expand Down

0 comments on commit 4fbd084

Please sign in to comment.