Last active
September 6, 2020 07:54
-
-
Save mainul35/a836cebce8acb8b3222d6831cc4d65d4 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@SpringBootApplication | |
public class ReactivespringApplication implements CommandLineRunner { | |
@Autowired | |
private DatabaseClient databaseClient; | |
@Autowired | |
private ReservationRepository reservationRepository; | |
public static void main(String[] args) { | |
SpringApplication.run(ReactivespringApplication.class, args); | |
} | |
@Override | |
public void run(String... args) throws Exception { | |
Arrays.asList("DROP TABLE IF EXISTS reservation;", | |
"CREATE TABLE reservation (room_id serial primary key, name varchar, check_in timestamp, check_out timestamp, price bigint, room_number integer);") | |
.forEach(s -> | |
databaseClient.execute(s) | |
.fetch() | |
.rowsUpdated() | |
.block() | |
); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment