Skip to content

Commit 2f93a6a

Browse files
committed
create url model and urls table
1 parent 93cf349 commit 2f93a6a

File tree

5 files changed

+28
-4
lines changed

5 files changed

+28
-4
lines changed

app/build.gradle.kts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ dependencies {
3030
compileOnly("org.projectlombok:lombok:1.18.36")
3131
annotationProcessor("org.projectlombok:lombok:1.18.36")
3232

33-
implementation("com.h2database:h2:2.2.220")
33+
implementation("com.h2database:h2:2.3.232")
3434
implementation("com.zaxxer:HikariCP:5.0.1")
3535
implementation("org.postgresql:postgresql:42.7.7")
3636
}

app/src/main/java/hexlet/code/App.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ private static int getPort() {
4040

4141
private static String getDatabaseUrl() {
4242
return System.getenv().getOrDefault("JDBC_DATABASE_URL",
43-
"jdbc:h2:mem:java-project-72;DB_CLOSE_DELAY=-1;");
43+
"jdbc:h2:mem:project;DB_CLOSE_DELAY=-1;");
4444
}
4545

4646
private static Javalin getApp() throws SQLException, IOException {
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
package hexlet.code.model;
2+
3+
import lombok.AllArgsConstructor;
4+
import lombok.Getter;
5+
import lombok.NonNull;
6+
import lombok.RequiredArgsConstructor;
7+
import lombok.Setter;
8+
9+
import java.sql.Timestamp;
10+
11+
@Getter
12+
@Setter
13+
@AllArgsConstructor
14+
@RequiredArgsConstructor(staticName = "of")
15+
public class Url {
16+
private Long id;
17+
@NonNull private String name;
18+
@NonNull private Timestamp createdAt;
19+
}
Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,7 @@
11
package hexlet.code.repository;
22

33
import com.zaxxer.hikari.HikariDataSource;
4-
import lombok.AllArgsConstructor;
54

6-
@AllArgsConstructor
75
public class BaseRepository {
86
public static HikariDataSource dataSource;
97
}

app/src/main/resources/schema.sql

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
DROP TABLE IF EXISTS urls;
2+
3+
CREATE TABLE urls (
4+
id BIGINT GENERATED ALWAYS AS IDENTITY PRIMARY KEY,
5+
name VARCHAR(255) NOT NULL,
6+
created_at TIMESTAMP
7+
);

0 commit comments

Comments
 (0)